1

Afternoon,

I have imported some data from excel to pandas using:

File = 'C:/Users/Ben/FTSEAXX_Utilities_Price.xlsx'
xlsx = pd.ExcelFile(File)
df = pd.read_excel(xlsx, 'Price_Data')

This has imported correctly, however the date is being displayed differently to the excel input.

excel:

Identifier  Company Name    31/12/2009  08/01/2010  15/01/2010  22/01/2010  29/01/2010

Python:

Identifier  Company Name    2009-12-31 00:00:00 2010-01-08 00:00:00 2010-01-15 00:00:00 2010-01-22 00:00:00 2010-01-29 00:00:00

How do i change it to get back to the more simple excel format?

thanks

Ben

3
  • 2
    Possible duplicate of python pandas incorrectly reading excel dates Commented Mar 15, 2016 at 12:48
  • 2
    if the dtype is datetime then it's just a display issue as it's showing time component and well as the system date format, you can change this to a different string representation but the dtype will change from datetime to str which is probably not what you want Commented Mar 15, 2016 at 13:09
  • 1
    No its not as the date in effectively the heading for the column and will need to remain in date format when it is exported back to excel. The primary issue is calling each column with pandas Commented Mar 15, 2016 at 13:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.