Deal With datetime

Let's see how to deal with datetime in pandas.

pandas contains extensive capabilities and features for time series data, so it provides a lot of functions to deal with datetime related requirements.

Generate date range

date_range can generate a series of dates where the default frequency is DAY.

The example below generates a series of five days.

import pandas as pd
pd.date_range("1/1/2020", periods=5)

You can change the frequency from DAY to WEEK by passing freq="W".

import pandas as
...