I have to develop production code to work with pandas 0.22.0. I get ValueError: Of the three parameters: start, end, and periods, exactly two must be specified
when I run the following code
import pandas as pd
pd.date_range(start='2020-03-20 00:00', end='2020-03-21 00:00', periods=5)
why is this happening?
This might have something to do with the pandas version. When I checked it with python 3.6.8 (pandas==0.22.0), I also get the same error:
But it works fine with python 3.7.3 (pandas==0.24.2):
As per the documentation for pandas 0.22.0: Of the three parameters: start, end, and periods, exactly two must be specified. See the Notes section
Also checked it for the latest version of pandas. This is what it says: Of the four parameters start, end, periods, and freq, exactly three must be specified. If freq is omitted, the resulting DatetimeIndex will have periods linearly spaced elements between start and end (closed on both sides). See the Notes Section