Skip to content

CLN (PY2): Remove DataFrame/Series.timetuple #26062

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 2 commits into from
Apr 15, 2019

Conversation

jorisvandenbossche
Copy link
Member

I was looking at the sphinx doc build warnings, and of them was complaining about the DataFrame/Series.timetuple attribute. This dummy timetuple attribute was added in #24056, to fix comparison with datetime.datetime.

Apart from the doc build problem (which can probably be fixed in another way as well), this also adds yet another (and for the rest useless / undocumented) attribute to our main classes.

But from a quick test (at least on linux with python 3.7, with Series) this is not needed to make it work. So removing again to see what travis/azure say.

@jbrockmendel do you remember the context of adding this?

@jorisvandenbossche jorisvandenbossche added this to the 0.25.0 milestone Apr 12, 2019
@codecov
Copy link

codecov bot commented Apr 12, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26062      +/-   ##
==========================================
- Coverage    91.9%   91.89%   -0.01%     
==========================================
  Files         175      175              
  Lines       52485    52484       -1     
==========================================
- Hits        48234    48230       -4     
- Misses       4251     4254       +3
Flag Coverage Δ
#multiple 90.45% <ø> (-0.01%) ⬇️
#single 40.74% <ø> (-0.15%) ⬇️
Impacted Files Coverage Δ
pandas/core/generic.py 93.54% <ø> (-0.01%) ⬇️
pandas/io/gbq.py 75% <0%> (-12.5%) ⬇️
pandas/core/frame.py 96.79% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.72% <0%> (+0.1%) ⬆️

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 a07ed59...accbbfe. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 12, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26062      +/-   ##
==========================================
- Coverage    91.9%   91.89%   -0.01%     
==========================================
  Files         175      175              
  Lines       52485    52506      +21     
==========================================
+ Hits        48234    48249      +15     
- Misses       4251     4257       +6
Flag Coverage Δ
#multiple 90.45% <ø> (-0.01%) ⬇️
#single 40.73% <ø> (-0.16%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/datetimes.py 96.4% <ø> (-0.01%) ⬇️
pandas/core/arrays/datetimes.py 97.79% <ø> (-0.01%) ⬇️
pandas/core/generic.py 93.54% <ø> (-0.01%) ⬇️
pandas/io/gbq.py 75% <0%> (-12.5%) ⬇️
pandas/core/sparse/frame.py 95.5% <0%> (-0.2%) ⬇️
pandas/compat/__init__.py 77.5% <0%> (-0.15%) ⬇️
pandas/core/frame.py 96.79% <0%> (-0.12%) ⬇️
pandas/plotting/_core.py 83.77% <0%> (-0.09%) ⬇️
pandas/core/dtypes/base.py 100% <0%> (ø) ⬆️
pandas/core/computation/expr.py 96.7% <0%> (ø) ⬆️
... and 6 more

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 a07ed59...46d4c42. Read the comment docs.

@jbrockmendel
Copy link
Member

do you remember the context of adding this?

I was under the impression that it was needed in order to get datetime.__op__(other) to return NotImplemented. If that impression was incorrect, then this may not be needed.

@jorisvandenbossche
Copy link
Member Author

In [1]: import datetime                                                                                                                                       

In [2]: dt = datetime.datetime(2012, 1, 1)                                                                                                                    

In [3]: s = pd.Series([dt, dt + datetime.timedelta(1)])                                                                                                       

In [4]: dt.__eq__(s)                                                                                                                                          
Out[4]: NotImplemented

On this branch (so without the attribute), but in a single env of course.

But I assume that you added tests for it in the original PR, so if the tests are green, we can rely on that?

@jreback
Copy link
Contributor

jreback commented Apr 12, 2019

btw i think was needed for PY2 as that attribute was looked for

@jorisvandenbossche
Copy link
Member Author

Ah, that might be a good reason that CI is green now

@jorisvandenbossche
Copy link
Member Author

Yes, can confirm that in Python 2 it was needed:

In [1]: import datetime

In [2]: dt = datetime.datetime(2012, 1, 1)

In [3]: s = pd.Series([dt, dt + datetime.timedelta(1)])

In [4]: dt == s
Out[4]: False

In [5]: pd.Series.timetuple=None

In [6]: s = pd.Series([dt, dt + datetime.timedelta(1)])

In [7]: dt == s
Out[7]: 
0     True
1    False
dtype: bool

Then we can remove it now. I think there are some other occurrences as well (on the arrays), let me check for that.

@jorisvandenbossche jorisvandenbossche changed the title Remove DataFrame/Series.timetuple CLN (PY2): Remove DataFrame/Series.timetuple Apr 15, 2019
@jreback jreback merged commit 23966ed into pandas-dev:master Apr 15, 2019
@jreback
Copy link
Contributor

jreback commented Apr 15, 2019

thanks @jorisvandenbossche

yhaque1213 pushed a commit to yhaque1213/pandas that referenced this pull request Apr 22, 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.

3 participants