# 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'])
Code Example |
---|
Python :: how to replace a word in text file using python |
:: list of dict values |
Python :: |
:: how to exit program in python |
:: save screenshot of screen in pygame |
Python :: |
Python :: make poetry env |
Python :: |
:: infinity python |
:: python join dict |
Python :: |
Python :: |
Python :: django filter queryset by date |
Python :: select multiple dict |
Python :: try with multiple except python |
Python :: |
Python :: |
Python :: bs4 innerhtml |
Python :: virtual mic with python |
:: add new row to dataframe pandas |
Python :: |
Python :: flask authentication user without database |
Python :: run python script on android |
:: laplace transform python |
Python :: substract list python |
Python :: current url in djago |
Python :: python string cut last n characters |
Python :: how to add values to a list in python |
:: ordered dictionary |
Python :: scikit learn roc curve |