0

I have a .csv file without headers. I want to import it to create a pandas dataframe object.

df1 = pd.read_csv(infile, global_sep, header = 0)

When doing print df1.head(), I yield the following output:

    1491895800000   -64  640  15424
0   1491895799995   -64  640  15424
1   1491895799990   -64  640  15424
2   1491895799985   -64  640  15424
3   1491895799980   -64  640  15424
4   1491895799975   -64  640  15424

Doing df1.reset_index(inplace = True, drop = True), doesn't change the output.

How to avoid NaN index values when Importing from .csv w/o headers to a pandas dataframe?

When doing

print df1.iloc[0]

The output should be

0 1491895800000   -64  640  15424
sudonym
  • 3,788
  • 4
  • 36
  • 61
  • related and probable dupe: http://stackoverflow.com/questions/29287224/pandas-read-in-table-without-headers – EdChum Apr 27 '17 at 12:06

1 Answers1

1

If you use:

df1 = pd.read_csv(infile, global_sep, header=None)

It will work.

zipa
  • 27,316
  • 6
  • 40
  • 58