My script uses pd.read_csv('example.csv')
to create data frames in python using pandas. The original CSV files being read only have two columns, but the data frame created by this read_csv
method is prepended with sort of an index-like column.
CSV before reading it:
text 100
text 200
text 300
text 400
but after reading it:
text 100
0 text 200
1 text 300
3 text 400
For the life of me, I can't get rid of that first column. Everything I try instead deletes the second column. I've tried a number of suggestions found online including:
df = df.iloc[: , 1:]
(from here)
df = df.drop(df.columns[[0]], axis=1)
(from here)
df = df.drop("", 1)
from here
For each of those, I either get an error or it removes the second column, leaving me with:
100
0 200
1 300
3 400
UPDATES:
I have also tried: df = pd.read_csv('example.csv', index_col=False)
and I still get the index column.