From the dropna
docstring:
Drop the columns where all elements are NaN:
df.dropna(axis=1, how='all')
A B D
0 NaN 2.0 0
1 3.0 4.0 1
2 NaN NaN 5
More Related Contents:
- How do I select rows from a DataFrame based on column values?
- Aggregation in Pandas
- Convert DataFrame column type from string to datetime
- How to apply a function to two columns of Pandas dataframe
- How to convert an XML file to nice pandas dataframe?
- Dynamically evaluate an expression from a formula in Pandas
- Constructing pandas DataFrame from values in variables gives “ValueError: If using all scalar values, you must pass an index”
- Can pandas automatically read dates from a CSV file?
- df.append() is not appending to the DataFrame
- How to get rid of “Unnamed: 0” column in a pandas DataFrame read in from CSV file?
- pandas dataframe str.contains() AND operation
- Pandas groupby mean – into a dataframe?
- pandas groupby without turning grouped by column into index
- Tilde sign in pandas DataFrame
- Drop columns whose name contains a specific string from pandas DataFrame
- Find the unique values in a column and then sort them
- how do I calculate a rolling idxmax
- Python Pandas How to assign groupby operation results back to columns in parent dataframe?
- Redefining the Index in a Pandas DataFrame object
- From password-protected Excel file to pandas DataFrame
- How to filter a pandas dataframe based on the length of a entry
- How can repetitive rows of data be collected in a single row in pandas?
- Group dataframe and get sum AND count?
- How is pandas groupby method actually working?
- Replace value for a selected cell in pandas DataFrame without using index
- Anti-Join Pandas
- What values are valid in Pandas ‘Freq’ tags?
- How to convert DataFrame.append() to pandas.concat()?
- How to efficiently assign unique ID to individuals with multiple entries based on name in very large df
- Difference between df[x], df[[x]], df[‘x’] , df[[‘x’]] and df.x