Answers for "drop the last column pandas"

9

drop last row pandas

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