1 year ago

#362925

test-img

AkariYukari

How to handle dates with 30 days per month in pandas?

I am currently working with a dataset in which every month has 30 days (including February). This causes problems converting with pd.datetime(). Does pandas have some built in function or setting that allows to work with 30 days per month? I looked for it, but didn't find anything. Maybe I simply missed a keyword that I should have specifically searched for.

An example: My dataset contains entries like this:

1950-02-30 19:00:00  11.799651  57.780991  0.114197
1950-02-30 20:00:00  11.799651  57.780991  0.113489
1950-02-30 21:00:00  11.799651  57.780991  0.138634
1950-02-30 22:00:00  11.799651  57.780991  0.167683
1950-02-30 23:00:00  11.799651  57.780991  0.197449

Due to the 30th February not existing in a normal calendar (obviously) I can not convert the dates with pd.datetime(). The normal datetime format normally comes in handy to determine things like the daily maximum.

python

pandas

date

date-formatting

0 Answers

Your Answer

Accepted video resources