-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
CLN: Remove unused variables #21986
CLN: Remove unused variables #21986
Changes from all commits
966d79a
a154bf5
b908aff
234984a
82683e5
d5ddbc1
0d7f077
8492e93
8a4f531
05e4a36
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 |
---|---|---|
|
@@ -1248,7 +1248,7 @@ def take_nd(self, indexer, axis, new_mgr_locs=None, fill_tuple=None): | |
if fill_tuple is None: | ||
fill_value = self.fill_value | ||
new_values = algos.take_nd(values, indexer, axis=axis, | ||
allow_fill=False) | ||
allow_fill=False, fill_value=fill_value) | ||
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 modification is deep within the internals (block's definition 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. this actually isn't used since allow_fill=False |
||
else: | ||
fill_value = fill_tuple[0] | ||
new_values = algos.take_nd(values, indexer, axis=axis, | ||
|
@@ -2699,7 +2699,6 @@ def _try_coerce_args(self, values, other): | |
|
||
values_mask = isna(values) | ||
values = values.view('i8') | ||
other_mask = False | ||
|
||
if isinstance(other, bool): | ||
raise TypeError | ||
|
@@ -2872,11 +2871,9 @@ def _try_coerce_args(self, values, other): | |
values_mask = _block_shape(isna(values), ndim=self.ndim) | ||
# asi8 is a view, needs copy | ||
values = _block_shape(values.asi8, ndim=self.ndim) | ||
other_mask = False | ||
|
||
if isinstance(other, ABCSeries): | ||
other = self._holder(other) | ||
other_mask = isna(other) | ||
|
||
if isinstance(other, bool): | ||
raise TypeError | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -479,7 +479,9 @@ def nanvar(values, axis=None, skipna=True, ddof=1): | |
|
||
@disallow('M8', 'm8') | ||
def nansem(values, axis=None, skipna=True, ddof=1): | ||
var = nanvar(values, axis, skipna, ddof=ddof) | ||
# This checks if non-numeric-like data is passed with numeric_only=False | ||
# and raises a TypeError otherwise | ||
nanvar(values, axis, skipna, ddof=ddof) | ||
|
||
mask = isna(values) | ||
if not is_float_dtype(values.dtype): | ||
|
@@ -635,7 +637,6 @@ def nankurt(values, axis=None, skipna=True): | |
adj = 3 * (count - 1) ** 2 / ((count - 2) * (count - 3)) | ||
numer = count * (count + 1) * (count - 1) * m4 | ||
denom = (count - 2) * (count - 3) * m2**2 | ||
result = numer / denom - adj | ||
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. huh? is not used? 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. is this not used? |
||
|
||
# floating point error | ||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2052,7 +2052,6 @@ def dot(self, other): | |
lvals = left.values | ||
rvals = right.values | ||
else: | ||
left = self | ||
lvals = self.values | ||
rvals = np.asarray(other) | ||
if lvals.shape[0] != rvals.shape[0]: | ||
|
@@ -2480,7 +2479,8 @@ def sort_values(self, axis=0, ascending=True, inplace=False, | |
dtype: object | ||
""" | ||
inplace = validate_bool_kwarg(inplace, 'inplace') | ||
axis = self._get_axis_number(axis) | ||
# Validate the axis parameter | ||
self._get_axis_number(axis) | ||
|
||
# GH 5856/5853 | ||
if inplace and self._is_cached: | ||
|
@@ -2652,7 +2652,8 @@ def sort_index(self, axis=0, level=None, ascending=True, inplace=False, | |
# TODO: this can be combined with DataFrame.sort_index impl as | ||
# almost identical | ||
inplace = validate_bool_kwarg(inplace, 'inplace') | ||
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. same with all of these |
||
axis = self._get_axis_number(axis) | ||
# Validate the axis parameter | ||
self._get_axis_number(axis) | ||
index = self.index | ||
|
||
if level is not None: | ||
|
@@ -3073,7 +3074,8 @@ def _gotitem(self, key, ndim, subset=None): | |
versionadded='.. versionadded:: 0.20.0', | ||
**_shared_doc_kwargs)) | ||
def aggregate(self, func, axis=0, *args, **kwargs): | ||
axis = self._get_axis_number(axis) | ||
# Validate the axis parameter | ||
self._get_axis_number(axis) | ||
result, how = self._aggregate(func, *args, **kwargs) | ||
if result is None: | ||
|
||
|
@@ -3919,8 +3921,8 @@ def dropna(self, axis=0, inplace=False, **kwargs): | |
if kwargs: | ||
raise TypeError('dropna() got an unexpected keyword ' | ||
'argument "{0}"'.format(list(kwargs.keys())[0])) | ||
|
||
axis = self._get_axis_number(axis or 0) | ||
# Validate the axis parameter | ||
self._get_axis_number(axis or 0) | ||
|
||
if self._can_hold_na: | ||
result = remove_na_arraylike(self) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -642,6 +642,13 @@ def test_series_from_json_precise_float(self): | |
result = read_json(s.to_json(), typ='series', precise_float=True) | ||
assert_series_equal(result, s, check_index_type=False) | ||
|
||
def test_series_with_dtype(self): | ||
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 test should hit the modification made here: https://github.com/mroeschke/pandas/blob/0d7f07783ad9a42bb3fc7f0e3dda0c01b877fe57/pandas/io/json/json.py#L550 |
||
# GH 21986 | ||
s = Series([4.56, 4.56, 4.56]) | ||
result = read_json(s.to_json(), typ='series', dtype=np.int64) | ||
expected = Series([4] * 3) | ||
assert_series_equal(result, expected) | ||
|
||
def test_frame_from_json_precise_float(self): | ||
df = DataFrame([[4.56, 4.56, 4.56], [4.56, 4.56, 4.56]]) | ||
result = read_json(df.to_json(), precise_float=True) | ||
|
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.
We’re there cases before where the wrong thing was passed? I.e. None != ordered != self.ordered?
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.
is this tested anywhere? I agree this should have broken things
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.
It appears that all instances of this private method
_create_from_codes
in the codebase never passed an arg toordered
(i.e.ordered
always defaulted toNone
which always got reassigned toself.ordered
here)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.