0

I want to read excel values as they appear in excel. I understand python extracts the intrinsic values from excel not the formatted version but I'm interested in the formatted version.

Is there any way to do this in pandas?

I know I can do it in other libraries like openpyxl but I'm interested to find out if pandas can somehow do this?

Here's a sample of the excel data

enter image description here

Here's what the data looks like when using pandas

enter image description here

Note - the formatting is not fixed, so I cannot simply convert each row/cell myself.

Similar to this question but it was asked almost 3 years ago. pandas read excel as formatted

Boosted_d16
  • 13,340
  • 35
  • 98
  • 158
  • Can you show us the expected output ? – BENY May 09 '19 at 01:29
  • What do you want to do with the data after putting it in pandas? You have multiple data types in the same column so the only way you could represent it (even if you could do it) is as a string, which kind of limits what you're able to do with it – jesseWUT May 09 '19 at 02:01
  • The data will be piped into another programme which does fun things. I'd be happy if all the values were strings. I tried it but failed. – Boosted_d16 May 09 '19 at 02:04
  • `df = df.astype(str)`? – Quang Hoang May 09 '19 at 02:59
  • I think you would have to convert them to text in excel first. – run-out May 09 '19 at 04:02
  • Seems to me that [Openpyxl support is coming to excel_read()](https://github.com/pandas-dev/pandas/pull/25092) *soon-ish* (i.e. has a milestone for the next `pandas` version, 0.25.0); apart from this, I don't think much has changed since the 3-year-old (duplicate?) question you've found already. – Asmus May 09 '19 at 05:14
  • @QuangHoang df = df.astype(str) did nothing, well it converts the underlying data to str not the values we see in excel. – Boosted_d16 May 09 '19 at 13:10

0 Answers0