My dataframe keeps making columns with name 'Unnamed' [duplicate]

import pandas as pd
import seaborn as sn
import matplotlib.pyplot as plt
from datetime import datetime
import numpy as np

df = pd.read_csv(r"C:\Users\bossd\OneDrive\Документы\datarn.csv")
df.drop(columns = df.columns[0], axis = 1)
display(df)

Everytime i want to delete the first column which always gets named 'Unnamed' and appears everytime i want to save changes with

df.to_csv(r"C:\Users\bossd\OneDrive\Документы\datarn.csv")

And after i do this the column reappers or just doesn't delete, how do i delete these unnamed rows and save changes to a dataframe to be completely clear from these columns and have 'timestamp' as first column.

(https://i.stack.imgur.com/Q66ha.png)

Tried doing

df = df.drop(columns = df.columns[0], axis = 1)

but it doesn't help me with this problem and the columns keep appearing

Also whenever i open the csv file i get this additional column that didn't exist before

(https://i.stack.imgur.com/jJ9WN.png)



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation