-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Convert to native datatypes for Series.tolist() #13050
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
Conversation
@@ -82,6 +82,14 @@ def test_to_csv_unicode_index(self): | |||
|
|||
assert_series_equal(s, s2) | |||
|
|||
def test_tolist_np(self): | |||
# GH10904 | |||
np_array = np.array([1, 2, 3]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls check for all dtypes (well the numeric ones). Further construct against an absolute test, rather than again what numpy does. E.g. you want to check that things are actually python integers, floats etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
Current coverage is 84.15%@@ master #13050 diff @@
==========================================
Files 137 137
Lines 50261 50214 -47
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 42288 42253 -35
+ Misses 7973 7961 -12
Partials 0 0
|
@@ -82,6 +82,26 @@ def test_to_csv_unicode_index(self): | |||
|
|||
assert_series_equal(s, s2) | |||
|
|||
def test_tolist_np_int(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, do this in a list inside a single tests. copy-pasting code is bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
I will correct this under
|
Please review |
# GH10904 | ||
[self.assertEqual(type(pd.Series([1], dtype=t).tolist()[0]), int) | ||
for t in ['uint8', 'uint16']] | ||
if sys.version_info[0] < 3: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use compat.PY2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use compat.long
(thus no need to check python ver).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified
needs a whats new with an example |
added whatsnew |
Please review |
~~~~~~~~~~~~ | ||
|
||
Series.tolist() updated to use Python types | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this ^^^
be the same length as the title.
Series.tolist()
will now return Python types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
thanks @gliptak |
git diff upstream/master | flake8 --diff