Answers for "eliminate some columns python dataframe"

1

delete unnamed coloumns in pandas

# Best method so far.
df = df.loc[:, ~df.columns.str.contains('^Unnamed')]
Posted by: Guest on May-24-2021
0

remove columns that start with pandas

cols = [c for c in df.columns if c.lower()[:6] != 'string']
df=df[cols]
Posted by: Guest on March-16-2021

Code answers related to "eliminate some columns python dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language