Answers for "drop first column read_csv"

0

drop first column read_csv

# Read column names from file
cols = list(pd.read_csv("sample_data.csv", nrows =1))
print(cols)

# Use list comprehension to remove the unwanted column in **usecol**
df= pd.read_csv("sample_data.csv", usecols =[i for i in cols if i != 'name'])
Posted by: Guest on July-12-2020

Code answers related to "drop first column read_csv"

Python Answers by Framework

Browse Popular Code Answers by Language