How to make pandas.read_excel with engine=’openpyxl’ behave like it did with xlrd, not showing nanoseconds by default?

We Are Going To Discuss About How to make pandas.read_excel with engine=’openpyxl’ behave like it did with xlrd, not showing nanoseconds by default?. So lets Start this Python Article.

How to make pandas.read_excel with engine=’openpyxl’ behave like it did with xlrd, not showing nanoseconds by default?

  1. How to solve How to make pandas.read_excel with engine='openpyxl' behave like it did with xlrd, not showing nanoseconds by default?

    Regardless of the engine and the version of openpyxl, you can simply remove the nanoseconds like this:
    df['testDate'] = df['testDate'].str[:-7] # testDate #0 2020-09-24 01:00:00 #1 2020-09-09 16:25:59 #2 2020-09-09 16:26:00

  2. How to make pandas.read_excel with engine='openpyxl' behave like it did with xlrd, not showing nanoseconds by default?

    Regardless of the engine and the version of openpyxl, you can simply remove the nanoseconds like this:
    df['testDate'] = df['testDate'].str[:-7] # testDate #0 2020-09-24 01:00:00 #1 2020-09-09 16:25:59 #2 2020-09-09 16:26:00

Solution 1

Regardless of the engine and the version of openpyxl, you can simply remove the nanoseconds like this:

df['testDate'] = df['testDate'].str[:-7]

#              testDate
#0  2020-09-24 01:00:00
#1  2020-09-09 16:25:59
#2  2020-09-09 16:26:00

Original Author Park Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment