Skip to content

BUG: Fix index bug due to parse_time_string GH24091 #24294

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

Closed

Conversation

simonariddell
Copy link
Contributor

In Issue #24091 I detailed the root cause of the bug, and implemented the @toobaz suggestion.

I added a single line to test this case in the existing test, ran the full UT suite, checked the linting, and added a whatsnew (I added the whatsnew in the other category, as It wasn't clear where it belonged).

@pep8speaks
Copy link

Hello @SimonAlecks! Thanks for submitting the PR.

@codecov
Copy link

codecov bot commented Dec 15, 2018

Codecov Report

Merging #24294 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24294      +/-   ##
==========================================
- Coverage   92.22%   92.22%   -0.01%     
==========================================
  Files         162      162              
  Lines       51824    51824              
==========================================
- Hits        47795    47794       -1     
- Misses       4029     4030       +1
Flag Coverage Δ
#multiple 90.62% <ø> (-0.01%) ⬇️
#single 43.01% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/datetimes.py 96.17% <0%> (-0.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b0fa8e...518545d. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Dec 15, 2018

Codecov Report

Merging #24294 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24294      +/-   ##
==========================================
- Coverage   92.22%   92.22%   -0.01%     
==========================================
  Files         162      162              
  Lines       51824    51824              
==========================================
- Hits        47795    47794       -1     
- Misses       4029     4030       +1
Flag Coverage Δ
#multiple 90.62% <ø> (-0.01%) ⬇️
#single 43.01% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/datetimes.py 96.17% <0%> (-0.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b0fa8e...518545d. Read the comment docs.

@jreback jreback added Bug Datetime Datetime data dtype labels Dec 15, 2018
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

add a test for the OP

@@ -1611,6 +1611,7 @@ Other
- Bug in :meth:`DataFrame.combine_first` in which column types were unexpectedly converted to float (:issue:`20699`)
- Bug where C variables were declared with external linkage causing import errors if certain other C libraries were imported before Pandas. (:issue:`24113`)
- Constructing a DataFrame with an index argument that wasn't already an instance of :class:`~pandas.core.Index` was broken in `4efb39f <https://github.com/pandas-dev/pandas/commit/4efb39f01f5880122fa38d91e12d217ef70fad9e>`_ (:issue:`22227`).
- :meth:`~pandas._libs.tslibs.parsing.parse_time_string` now raises a type error if the passed argument is not a string, (:issue:`24091`)
Copy link
Contributor

Choose a reason for hiding this comment

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

use TypeError. this is an internal method and doesn't need a note for this, rather the use facing case does.

@@ -25,6 +25,8 @@ def test_parse_time_string(self):
assert parsed == parsed_lower
assert reso == reso_lower

pytest.raises(TypeError, parse_time_string, Period('2018-11-01', 'B'))
Copy link
Contributor

Choose a reason for hiding this comment

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

use a context manger here, make this a separate test, and add the issue as a comment

@jreback jreback added Period Period data type MultiIndex labels Dec 15, 2018
@jreback
Copy link
Contributor

jreback commented Jan 5, 2019

can you merge master and update

@WillAyd
Copy link
Member

WillAyd commented Feb 27, 2019

Closing as stale. Ping if you'd like to continue

@WillAyd WillAyd closed this Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype MultiIndex Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: loc behaves incorrectly on PeriodIndex within MultiIndex with 3 levels
4 participants