Answers for "drop last 5 columns from df"

9

drop the last row of a dataframe

df.drop(df.tail(n).index,inplace=True) # drop last n rows
Posted by: Guest on June-23-2020
0

pandas read_csv drop last column

# Drop last column of a dataframe
df = df.iloc[: , :-1]
# Drop last 2 column of a dataframe
df = df.iloc[: , :-2]
Posted by: Guest on August-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language