pandas to_csv with no index
Solution:
use index=False while saving your dataframe to CSV file.
df.to_csv('file_name.csv',index=False)
- You can save your dataframe as it is with an index, and while reading you just drop the column unnamed 0 containing your previous index. Simple!
df.to_csv(' file_name.csv ')
df_new = pd.read_csv('file_name.csv').drop(['unnamed 0'],axis=1)
Another solution if you want to keep this column as an index.
pd.read_csv('filename.csv', index_col='Unnamed: 0')