yef_dan_92
yef_dan_92

Reputation: 175

read_csv file in pandas reads whole csv file in one column

I want to read csvfile in pandas. I have used function:

ace = pd.read_csv('C:\\Users\\C313586\\Desktop\\Daniil\\Daniil\\ACE.csv',sep = '\t')

And as output I got this:

a)First row(should be header)

_AdjustedNetWorthToTotalCapitalEmployed _Ebit _StTradeRec _StTradePay _OrdinaryCf _CfWorkingC _InvestingAc _OwnerAc _FinancingAc _ProdValueGrowth _NetFinancialDebtTotalAdjustedCapitalEmployed_BanksAndOtherInterestBearingLiabilitiesTotalEquityAndLiabilities _NFDEbitda _DepreciationAndAmortizationProductionValue _NumberOfDays _NumberOfDays360

#other rows separated by tab
0   5390\t0000000000000125\t0\t2013-12-31\t2013\tF...
1   5390\t0000000000000306\t0\t2015-12-31\t2015\tF...
2   5390\t00000000000003VG\t0\t2015-12-31\t2015\tF...
3   5390\t0000000000000405\t0\t2016-12-31\t2016\tF...
4   5390\t00000000000007VG\t0\t2013-12-31\t2013\tF...
5   5390\t0000000000000917\t0\t2015-12-31\t2015\tF...
6   5390\t00000000000009VG\t0\t2016-12-31\t2016\tF...
7   5390\t0000000000001052\t0\t2015-12-31\t2015\tF...
8   5390\t00000000000010SG\t0\t2015-12-31\t2015\tF...

Do you have any ideas why it happens? How can I fix it?

Upvotes: 1

Views: 555

Answers (1)

Mathias711
Mathias711

Reputation: 6658

You should use the argument sep=r'\t' (note the extra r). This will make pandas search for the exact string \t (the r stands for raw)

Upvotes: 2

Related Questions