-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Open
Labels
BugDatetimeDatetime data dtypeDatetime data dtypeError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandas
Description
Code Sample
import pandas as pd
print(pd.date_range(start="2018-10-17", periods=7, closed="left"))
print(pd.date_range(start="2018-10-17", periods=7, closed="right"))
print(pd.date_range(end="2018-10-17", periods=7, closed="left"))
print(pd.date_range(end="2018-10-17", periods=7, closed="right"))
Problem description
There is a check in the code that should not allow this cases. It raises a ValueError
. The if
condition is bugged and thus this check is not being processed. This was found while investigating #23176.
Note: this issue is not debating wether allowing or disallowing closed
differents to None
for only partially bounded date_range
es (understanding partially bounded as only one of start
and end
provided). It is just pointing out that the current code is skipping a check.
Expected Output
1:
ValueError("Closed has to be None if not both of startand end are defined")
2:
ValueError("Closed has to be None if not both of startand end are defined")
3:
ValueError("Closed has to be None if not both of startand end are defined")
4:
ValueError("Closed has to be None if not both of startand end are defined")
Output of pd.show_versions()
python: 3.6.4.final.0
pandas: 0.23.4
Metadata
Metadata
Assignees
Labels
BugDatetimeDatetime data dtypeDatetime data dtypeError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandas