1

I have a dataframe that generates from pd.pivot_table with columns having datetime.

I want to calculate the time difference along columns. So I used df.diff(axis=1). I got NotImplementedError.

I came across this pull request in Github: https://github.com/pandas-dev/pandas/pull/19773

I guess the problem has been solved? Why I still get NonImplementedError?

Data Sample: enter image description here Please ignore the "Text". Typo.

11
  • What version of pandas are you running? Maybe just need to upgrade? Commented Mar 9, 2020 at 7:57
  • @ChrisA I use 1.0.1 Commented Mar 9, 2020 at 8:01
  • Hmmm, I'm using the same. Working for me with datetime types. What about versions for numpy and python-dateutil ? Commented Mar 9, 2020 at 8:03
  • @ChrisA numpy 1.18.1 python-dateutil 2.8.1 Commented Mar 9, 2020 at 8:06
  • 1
    @ChrisA I got it works by removing the timezone: data['date'] = data['date'].dt.tz_convert(None) Commented Mar 9, 2020 at 8:22

1 Answer 1

2

I tried to remove the timezone in datetime64[ns, UTC] columns. It works!

data['date'] = data['date'].dt.tz_convert(None)

Sign up to request clarification or add additional context in comments.

1 Comment

gosh, i appreciate the ability to work with timezones, but they really screw up all the formatting. i wish the default would have stayed at not having them. suddenly, CSV readings produce different outputs... :(

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.