Skip to content

DTA Followups - remove redundant methods #24577

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

Merged
merged 4 commits into from
Jan 3, 2019

Conversation

jbrockmendel
Copy link
Member

Both arrays.datetimes and arrays.timedeltas have a _to_m8 function. The timedeltas one is removed since it is unnecessary, the datetimes one is given a more accurate name _to_M8

A couple of unused funcs from tm are removed.

A test is parametrized.

@jreback jreback added the Clean label Jan 3, 2019
@@ -400,98 +400,98 @@ def test_value_counts_unique_nunique(self):

assert o.nunique() == len(np.unique(o.values))

def test_value_counts_unique_nunique_null(self):
@pytest.mark.parametrize('null_obj', [np.nan, None])
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this is a nasty test

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.

lgtm. some comments.

@@ -34,7 +34,7 @@
_midnight = time(0, 0)


def _to_m8(key, tz=None):
def _to_M8(key, tz=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the conversion just (line 50)

In [1]: from pandas._libs.tslibs import conversion

In [2]: ts = pd.Timestamp('20181001', tz='UTC')

In [3]: np.int64(conversion.pydt_to_i8(ts)).view('M8[ns]')
Out[3]: numpy.datetime64('2018-10-01T00:00:00.000000000')

In [5]: ts.to_datetime64()
Out[5]: numpy.datetime64('2018-10-01T00:00:00.000000000')

Copy link
Contributor

Choose a reason for hiding this comment

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

this routine should really just be in conversion.pyx

Copy link
Member Author

Choose a reason for hiding this comment

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

I’m hoping we can do something clever see #24576. Not sure we are internally consistent enough to do that yet though.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #24577 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24577      +/-   ##
==========================================
+ Coverage   92.33%   92.36%   +0.02%     
==========================================
  Files         166      166              
  Lines       52544    52494      -50     
==========================================
- Hits        48517    48486      -31     
+ Misses       4027     4008      -19
Flag Coverage Δ
#multiple 90.79% <100%> (+0.02%) ⬆️
#single 43.03% <61.53%> (-0.02%) ⬇️
Impacted Files Coverage Δ
pandas/core/arrays/datetimelike.py 97.85% <ø> (+1.08%) ⬆️
pandas/core/indexes/datetimelike.py 98.83% <ø> (+1.96%) ⬆️
pandas/util/testing.py 88.09% <ø> (+0.38%) ⬆️
pandas/core/arrays/timedeltas.py 87.99% <100%> (-0.12%) ⬇️
pandas/core/arrays/datetimes.py 98.01% <100%> (-0.01%) ⬇️
pandas/core/indexes/timedeltas.py 90.22% <100%> (ø) ⬆️
pandas/core/indexes/period.py 92.12% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 96.22% <100%> (ø) ⬆️

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 43b35fc...1793bbc. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #24577 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24577      +/-   ##
==========================================
+ Coverage   92.33%   92.36%   +0.02%     
==========================================
  Files         166      166              
  Lines       52544    52494      -50     
==========================================
- Hits        48517    48486      -31     
+ Misses       4027     4008      -19
Flag Coverage Δ
#multiple 90.79% <100%> (+0.02%) ⬆️
#single 43.03% <61.53%> (-0.02%) ⬇️
Impacted Files Coverage Δ
pandas/core/arrays/datetimelike.py 97.85% <ø> (+1.08%) ⬆️
pandas/core/indexes/datetimelike.py 98.83% <ø> (+1.96%) ⬆️
pandas/util/testing.py 88.09% <ø> (+0.38%) ⬆️
pandas/core/arrays/timedeltas.py 87.99% <100%> (-0.12%) ⬇️
pandas/core/arrays/datetimes.py 98.01% <100%> (-0.01%) ⬇️
pandas/core/indexes/timedeltas.py 90.22% <100%> (ø) ⬆️
pandas/core/indexes/period.py 92.12% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 96.22% <100%> (ø) ⬆️

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 43b35fc...1793bbc. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Jan 3, 2019
@jreback jreback merged commit 4b91140 into pandas-dev:master Jan 3, 2019
@jreback
Copy link
Contributor

jreback commented Jan 3, 2019

thanks

@jbrockmendel jbrockmendel deleted the followup branch January 3, 2019 02:31
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants