0

I am facing issue in reading excel column using pandas library. In excel column value is described as "500,000,000.00" but when i read i get value 500000000.

how do I read exact value.
I tried converting cell value to string but it did not work for me

import pandas as pd  
strpath = "C:\\Deal.xls"
df=pd.read_excel(strpath,dtype=str)
header =  df.columns.tolist()
verificationData=df[header[0]].tolist()
print verificationData

Attaching excel snippet for reference. Excel file screen shot

Bonifacio2
  • 3,405
  • 6
  • 34
  • 54
Deepak
  • 3
  • 2

2 Answers2

0

Try the below given code and see if it solves your issue.

q = pd.read_excel('strpath',converters={'col_name': str})

Go through this link:

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_excel.html

Devendra Mishra
  • 19
  • 1
  • 1
  • 5
0

Am I missing something? It's the same number, just the formatting is different. Try the following if it's the formatting you're after:

In []: "{:,.2f}".format(round(float(500000000), 3))
Out[]: '500,000,000.00'

If you're asking about the formatting, this is a duplicate. If not, then I don't quite understand the question.