Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: date_range doesn't propagate ambigous=False to tz_localize #35302

Merged
merged 15 commits into from
Aug 1, 2020

Conversation

arw2019
Copy link
Member

@arw2019 arw2019 commented Jul 16, 2020

@@ -418,9 +418,9 @@ def _generate_range(
# index is localized datetime64 array -> have to convert
# start/end as well to compare
if start is not None:
start = start.tz_localize(tz).asm8
start = start.tz_localize(tz, ambiguous).asm8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also pass nonexistent and write a test case for that issue as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added both

@@ -941,7 +941,7 @@ Timezones
^^^^^^^^^

- Bug in :func:`to_datetime` with ``infer_datetime_format=True`` where timezone names (e.g. ``UTC``) would not be parsed correctly (:issue:`33133`)
-
- Bug in :func:`date_range` was raising AmbiguousTimeError for valid input with `ambiguous=False` (:issue:`35297`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to 1.2.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure! I don't think we have doc/source/whatsnew/v1.2.0.rst atm - shall I create it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that'd be great.

@mroeschke mroeschke added Bug Timezones Timezone data dtype labels Jul 16, 2020
@mroeschke mroeschke added this to the 1.2 milestone Jul 16, 2020
@arw2019
Copy link
Member Author

arw2019 commented Jul 16, 2020

@mroeschke Getting an error in the doctests that I think is unrelated to this PR:

=================================== FAILURES ===================================
__________________ [doctest] pandas.core.frame.DataFrame.info __________________
2593             Data columns (total 3 columns):
2594              #   Column    Non-Null Count    Dtype
2595             ---  ------    --------------    -----
2596              0   column_1  1000000 non-null  object
2597              1   column_2  1000000 non-null  object
2598              2   column_3  1000000 non-null  object
2599             dtypes: object(3)
2600             memory usage: 22.9+ MB
2601 
2602             >>> df.info(memory_usage='deep')
Differences (unified diff with -expected +actual):
    @@ -2,9 +2,9 @@
     RangeIndex: 1000000 entries, 0 to 999999
     Data columns (total 3 columns):
    - #   Column    Non-Null Count    Dtype
    ----  ------    --------------    -----
    + #   Column    Non-Null Count    Dtype 
    +---  ------    --------------    ----- 
      0   column_1  1000000 non-null  object
      1   column_2  1000000 non-null  object
      2   column_3  1000000 non-null  object
     dtypes: object(3)
    -memory usage: 188.8 MB
    +memory usage: 165.9 MB

I merged with master just now so I don't think it's because this branch is out-of-date

@mroeschke
Copy link
Member

No worries, looks unrelated to this PR

Actually sorry, could you move the creation of the 1.2.0 whatsnew doc to a separate PR? Would make this PR cleaner.

@arw2019 arw2019 mentioned this pull request Jul 17, 2020
@simonjayhawkins simonjayhawkins merged commit 017bde1 into pandas-dev:master Aug 1, 2020
@simonjayhawkins
Copy link
Member

Thanks @arw2019

@arw2019 arw2019 deleted the gh35297 branch August 1, 2020 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: AmbiguousTimeError when using date_range even when argument ambiguous is set
3 participants