-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
numpydev ragged array dtype warning #31203
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ def cat_core(list_of_columns: List, sep: str): | |
return np.sum(arr_of_cols, axis=0) | ||
list_with_sep = [sep] * (2 * len(list_of_columns) - 1) | ||
list_with_sep[::2] = list_of_columns | ||
arr_with_sep = np.asarray(list_with_sep) | ||
arr_with_sep = np.asarray(list_with_sep, dtype=object) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. darn, i thought i had already fixed this one |
||
return np.sum(arr_with_sep, axis=0) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,7 +245,9 @@ def test_take_non_na_fill_value(self, data_missing): | |
fill_value = data_missing[1] # valid | ||
na = data_missing[0] | ||
|
||
array = data_missing._from_sequence([na, fill_value, na]) | ||
array = data_missing._from_sequence( | ||
[na, fill_value, na], dtype=data_missing.dtype | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this sort of changes the interface. do we want authors to handle this on their own? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does it change the interface? We are reducing coverage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yah, i guess that is a better description than "changes the interface" |
||
result = array.take([-1, 1], fill_value=fill_value, allow_fill=True) | ||
expected = array.take([1, 1]) | ||
self.assert_extension_array_equal(result, expected) | ||
|
@@ -293,10 +295,12 @@ def test_reindex_non_na_fill_value(self, data_missing): | |
valid = data_missing[1] | ||
na = data_missing[0] | ||
|
||
array = data_missing._from_sequence([na, valid]) | ||
array = data_missing._from_sequence([na, valid], dtype=data_missing.dtype) | ||
ser = pd.Series(array) | ||
result = ser.reindex([0, 1, 2], fill_value=valid) | ||
expected = pd.Series(data_missing._from_sequence([na, valid, valid])) | ||
expected = pd.Series( | ||
data_missing._from_sequence([na, valid, valid], dtype=data_missing.dtype) | ||
) | ||
|
||
self.assert_series_equal(result, expected) | ||
|
||
|
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.
FYI, at least in our tests, this isn't changing behavior. I added an
assert com.index_labels_to_array(codes, dtype=object).dtype == com.index_labels_to_array(codes)
temporarily, so we were always inferring object dtype here (in our tests).