I know to delete a column I can use df = df.drop('column_name', 1)
, but how would I remove a column just by indexing which column it is? As in without inserting the name?
Sorry if this question has been repeated I can't seem to find it
You can delete column by index i
df.drop(df.columns[i], axis=1)
Adapted from duplicate question:
https://stackoverflow.com/a/20301769/3006366
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With