Answers for "drop a column if it exists from dataframe"

0

is coumn exist then delete in datafrmae

if 'A' in df.columns:
    del df['A']
Posted by: Guest on September-10-2020
0

drop a column if it exists from dataframe

df = df.drop(['col1', 'col2'], axis=1, errors='ignore')
Posted by: Guest on July-08-2021

Code answers related to "drop a column if it exists from dataframe"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language