dataframe:
|--------------------------------------------------------------------|
| Name | email | Phone no | Gender |
|----------------|-------------------|--------------|----------------|
|legacy | target |legacy | target |legacy|target |legacy | target |
|-------|--------|----------|--------|------|-------|-------|--------|
|Name1 |Name1 |n1@abc.com| | | | | |
|Name2 |Name2 | | | | 12 | | |
|--------------------------------------------------------------------|
Expected output:
|---------------------------------------------------|
| Name | email | Phone no |
|----------------|-------------------|--------------|
|legacy | target |legacy | target |legacy|target |
|-------|--------|----------|--------|------|-------|
|Name1 |Name1 |n1@abc.com| | | |
|Name2 |Name2 | | | | 12 |
|---------------------------------------------------|
I am using the below code, but it is removing "email target" and "phone no legacy" column as well.
df.dropna(how='all', axis=1, inplace=True)
However I want to drop only the "Gender" column as this is the only column where both legacy and target fields are completely blank.
Could anyone please help me.
Thank you.