Skip to content Skip to sidebar Skip to footer

How To Read Csv Without Header In Pandas

I use Adj = pd.read_csv('xxxxxx.csv', usecols=['Adj Close']) to read my csv file and result is looks like: Adj Close 0 0.007427 1 0.002013 2 0.008874 my cs

Solution 1:

Try

Adj = pd.read_csv('xxxxxx.csv', usecols=["Adj Close"])['Adj Close'].values

That will ingest the csv, select the Adj Close column, and then select the underlying numpy array.

Solution 2:

It should be something like:

Adj = pd.read_csv('xxxxxx.csv', usecols=["Adj Close"], header=False)

Solution 3:

To read a csv file without header, do as follows:

data = pd.read_csv(filepath, header=None)

As EdChum commented, the questions isn't clear. But this is the first google result when searching for reading a csv file without header. So, I've added a solution for that, in case somebody else lands here looking for a solution for that.

Post a Comment for "How To Read Csv Without Header In Pandas"