Skip to content

BUG: Empty lists shouldn't be counted as DateOffsets. See #13844 #13889

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
wants to merge 3 commits into from
Closed

Conversation

tom-bird
Copy link
Contributor

@tom-bird tom-bird commented Aug 3, 2016

@jreback
Copy link
Contributor

jreback commented Aug 3, 2016

tests!

@tom-bird
Copy link
Contributor Author

tom-bird commented Aug 3, 2016

Ah, sorry. Could you point me in the direction of the relevant test file? The structure is different to numpy...

@jreback
Copy link
Contributor

jreback commented Aug 3, 2016

contributing docs

this is prob in tseries/tests_timeseries.py though maybe in tests/series/test_* (somewhere) as well. you will have to find something similar and put right after.

@codecov-io
Copy link

codecov-io commented Aug 3, 2016

Current coverage is 85.31% (diff: 100%)

Merging #13889 into master will increase coverage by <.01%

@@             master     #13889   diff @@
==========================================
  Files           139        139          
  Lines         50138      50143     +5   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          42769      42777     +8   
+ Misses         7369       7366     -3   
  Partials          0          0          

Powered by Codecov. Last update 3186fef...cb26d25

@sinhrks sinhrks added Bug Dtype Conversions Unexpected or buggy dtype conversions Timedelta Timedelta data type labels Aug 3, 2016
@tom-bird
Copy link
Contributor Author

tom-bird commented Aug 5, 2016

Thanks. Right I've inserted a test in each of the files you mentioned. To be honest the logical distinction between the different classes in the test files wasn't that clear to me, so please say if they are in the wrong segment.

First time contributing to pandas so just finding my feet!

@@ -598,7 +598,10 @@ def _is_offset(self, arr_or_obj):
if isinstance(arr_or_obj, pd.DateOffset):
return True
elif is_list_like(arr_or_obj):
return all(isinstance(x, pd.DateOffset) for x in arr_or_obj)
if len(arr_or_obj):
return all(isinstance(x, pd.DateOffset) for x in arr_or_obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

you can just collapse this (meaning remove the else clauses and just return False at the end of the function

BUG: Empty lists shouldn't be counted as DateOffsets. See #13844

BUG: Empty lists shouldn't be counted as DateOffsets. See #13844
b = Series(dtype='m8[ns]')
assert_series_equal(a, a + b)
assert_series_equal(a, a - b)
assert_series_equal(a, b + a)
Copy link
Contributor

Choose a reason for hiding this comment

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

add the b - a (which should raise)

@jreback jreback added this to the 0.19.0 milestone Aug 6, 2016
@jreback
Copy link
Contributor

jreback commented Aug 6, 2016

minor points. ping on green.

@tom-bird
Copy link
Contributor Author

tom-bird commented Aug 7, 2016

thanks, will amend

@jreback
Copy link
Contributor

jreback commented Aug 18, 2016

lgtm. pls add a whatsnew note in Bug Fixes.

@jreback
Copy link
Contributor

jreback commented Aug 26, 2016

thanks!

@jreback jreback closed this in 0db4304 Aug 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty dataset: typerror ufunc add cannot use operands with types dtype('<M8[ns]') and dtype('O')
4 participants