From 966d79a9e50ca34a9e776583486d43f991915fd0 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Thu, 19 Jul 2018 21:11:03 -0700 Subject: [PATCH 1/7] CLN: Remove unused variables --- pandas/core/arrays/categorical.py | 1 - pandas/core/arrays/interval.py | 1 - pandas/core/generic.py | 2 ++ pandas/core/groupby/ops.py | 1 - pandas/core/indexes/base.py | 1 + pandas/core/indexes/category.py | 1 + pandas/core/indexes/interval.py | 1 - pandas/core/internals.py | 4 +--- pandas/core/nanops.py | 2 -- pandas/core/series.py | 6 ++++-- pandas/core/sparse/frame.py | 1 - pandas/core/window.py | 1 + pandas/io/formats/format.py | 2 ++ pandas/io/formats/html.py | 1 - pandas/io/formats/terminal.py | 2 +- pandas/io/json/json.py | 1 + pandas/io/sas/sas_xport.py | 1 + pandas/plotting/_timeseries.py | 1 - 18 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 973a8af76bb07..9b7863224bae0 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -347,7 +347,6 @@ def __init__(self, values, categories=None, ordered=None, dtype=None, " or `ordered`.") categories = dtype.categories - ordered = dtype.ordered elif is_categorical(values): # If no "dtype" was passed, use the one from "values", but honor diff --git a/pandas/core/arrays/interval.py b/pandas/core/arrays/interval.py index c915b272aee8b..d33a70df71ece 100644 --- a/pandas/core/arrays/interval.py +++ b/pandas/core/arrays/interval.py @@ -401,7 +401,6 @@ def from_tuples(cls, data, closed='right', copy=False, dtype=None): msg = ('{name}.from_tuples received an invalid ' 'item, {tpl}').format(name=name, tpl=d) raise TypeError(msg) - lhs, rhs = d left.append(lhs) right.append(rhs) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 610bcf5d1d6c4..abaa6d24a2453 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -1024,6 +1024,7 @@ def rename(self, *args, **kwargs): level = kwargs.pop('level', None) axis = kwargs.pop('axis', None) if axis is not None: + # TODO: axis is unused, is this just validating? axis = self._get_axis_number(axis) if kwargs: @@ -5207,6 +5208,7 @@ def __copy__(self, deep=True): def __deepcopy__(self, memo=None): if memo is None: + # TODO: memo is unused memo = {} return self.copy(deep=True) diff --git a/pandas/core/groupby/ops.py b/pandas/core/groupby/ops.py index f2c55a56b119d..6f1aa79b313b6 100644 --- a/pandas/core/groupby/ops.py +++ b/pandas/core/groupby/ops.py @@ -582,7 +582,6 @@ def _transform(self, result, values, comp_ids, transform_func, elif values.ndim > 2: for i, chunk in enumerate(values.transpose(2, 0, 1)): - chunk = chunk.squeeze() transform_func(result[:, :, i], values, comp_ids, is_datetimelike, **kwargs) else: diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 83b70baf4065b..1337a350f49bd 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -979,6 +979,7 @@ def __copy__(self, **kwargs): return self.copy(**kwargs) def __deepcopy__(self, memo=None): + # TODO: memo is unused if memo is None: memo = {} return self.copy(deep=True) diff --git a/pandas/core/indexes/category.py b/pandas/core/indexes/category.py index a03e478f81caf..39be802a7064b 100644 --- a/pandas/core/indexes/category.py +++ b/pandas/core/indexes/category.py @@ -132,6 +132,7 @@ def _create_from_codes(self, codes, categories=None, ordered=None, ordered = self.ordered if name is None: name = self.name + # TODO: ordered above is unused. Should ordered be passed below? cat = Categorical.from_codes(codes, categories=categories, ordered=self.ordered) return CategoricalIndex(cat, name=name) diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index e92f980caf3dc..b0fee35edfc52 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -939,7 +939,6 @@ def _format_data(self, name=None): summary = '[{head} ... {tail}]'.format( head=', '.join(head), tail=', '.join(tail)) else: - head = [] tail = [formatter(x) for x in self] summary = '[{tail}]'.format(tail=', '.join(tail)) diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 5a5418dcc1e7f..eb9dfefd78624 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -1255,6 +1255,7 @@ def take_nd(self, indexer, axis, new_mgr_locs=None, fill_tuple=None): values = self.get_values() if fill_tuple is None: + # TODO: fill_value is unused; should this be passed to take_nd? fill_value = self.fill_value new_values = algos.take_nd(values, indexer, axis=axis, allow_fill=False) @@ -2708,7 +2709,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 @@ -2881,11 +2881,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 diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py index de31c6ac11c3f..8cb8e92aea4a4 100644 --- a/pandas/core/nanops.py +++ b/pandas/core/nanops.py @@ -479,7 +479,6 @@ 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) mask = isna(values) if not is_float_dtype(values.dtype): @@ -635,7 +634,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 # floating point error # diff --git a/pandas/core/series.py b/pandas/core/series.py index 77445159129f2..99b8935fb1ded 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2051,7 +2051,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]: @@ -2479,6 +2478,7 @@ def sort_values(self, axis=0, ascending=True, inplace=False, dtype: object """ inplace = validate_bool_kwarg(inplace, 'inplace') + # TODO: axis is unused, is this just validation? axis = self._get_axis_number(axis) # GH 5856/5853 @@ -2651,6 +2651,7 @@ 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') + # TODO: axis is unused, is this just validation? axis = self._get_axis_number(axis) index = self.index @@ -3072,6 +3073,7 @@ def _gotitem(self, key, ndim, subset=None): versionadded='.. versionadded:: 0.20.0', **_shared_doc_kwargs)) def aggregate(self, func, axis=0, *args, **kwargs): + # TODO: axis is unused, is this just validation? axis = self._get_axis_number(axis) result, how = self._aggregate(func, *args, **kwargs) if result is None: @@ -3918,7 +3920,7 @@ def dropna(self, axis=0, inplace=False, **kwargs): if kwargs: raise TypeError('dropna() got an unexpected keyword ' 'argument "{0}"'.format(list(kwargs.keys())[0])) - + # TODO: axis is unused, is this just validation? axis = self._get_axis_number(axis or 0) if self._can_hold_na: diff --git a/pandas/core/sparse/frame.py b/pandas/core/sparse/frame.py index f7071061d07ab..818e46b0e53ee 100644 --- a/pandas/core/sparse/frame.py +++ b/pandas/core/sparse/frame.py @@ -597,7 +597,6 @@ def _combine_match_index(self, other, func, level=None): new_data[col] = func(series.values, other.values) # fill_value is a function of our operator - fill_value = None if isna(other.fill_value) or isna(self.default_fill_value): fill_value = np.nan else: diff --git a/pandas/core/window.py b/pandas/core/window.py index 6b6f27bcb3863..1c099175a218b 100644 --- a/pandas/core/window.py +++ b/pandas/core/window.py @@ -933,6 +933,7 @@ class _Rolling_and_Expanding(_Rolling): def count(self): blocks, obj, index = self._create_blocks() + # TODO: index & indexi, is this just validation? index, indexi = self._get_index(index=index) window = self._get_window() diff --git a/pandas/io/formats/format.py b/pandas/io/formats/format.py index f69e4a484d177..44b9fd69a0fd6 100644 --- a/pandas/io/formats/format.py +++ b/pandas/io/formats/format.py @@ -496,6 +496,8 @@ def _chk_truncate(self): self.tr_col_num = col_num if truncate_v: if max_rows_adj == 0: + # TODO: Should the next block be elif? row_num here will + # be overwritten. row_num = len(frame) if max_rows_adj == 1: row_num = max_rows diff --git a/pandas/io/formats/html.py b/pandas/io/formats/html.py index 20be903f54967..3ea5cb95b9c5a 100644 --- a/pandas/io/formats/html.py +++ b/pandas/io/formats/html.py @@ -222,7 +222,6 @@ def _column_header(): return row self.write('', indent) - row = [] indent += self.indent_delta diff --git a/pandas/io/formats/terminal.py b/pandas/io/formats/terminal.py index 52262ea05bf96..dcd6f2cf4a718 100644 --- a/pandas/io/formats/terminal.py +++ b/pandas/io/formats/terminal.py @@ -67,7 +67,7 @@ def is_terminal(): def _get_terminal_size_windows(): - res = None + try: from ctypes import windll, create_string_buffer diff --git a/pandas/io/json/json.py b/pandas/io/json/json.py index 3ec5e8d9be955..5c21556c730f7 100644 --- a/pandas/io/json/json.py +++ b/pandas/io/json/json.py @@ -547,6 +547,7 @@ def _get_object_parser(self, json): if typ == 'series' or obj is None: if not isinstance(dtype, bool): + # TODO: dtype is unused. Should this be an update on kwargs? dtype = dict(data=dtype) obj = SeriesParser(json, **kwargs).parse() diff --git a/pandas/io/sas/sas_xport.py b/pandas/io/sas/sas_xport.py index 52b25898fc67e..6887434de91ed 100644 --- a/pandas/io/sas/sas_xport.py +++ b/pandas/io/sas/sas_xport.py @@ -183,6 +183,7 @@ def _parse_float_vec(vec): # Get the second half of the ibm number into the second half of # the ieee number + # TODO: This value is unused. Should it be used in the calc below? ieee2 = xport2 # The fraction bit to the left of the binary point in the ieee diff --git a/pandas/plotting/_timeseries.py b/pandas/plotting/_timeseries.py index 0522d7e721b65..96e7532747c78 100644 --- a/pandas/plotting/_timeseries.py +++ b/pandas/plotting/_timeseries.py @@ -86,7 +86,6 @@ def _maybe_resample(series, ax, kwargs): freq = ax_freq elif frequencies.is_subperiod(freq, ax_freq) or _is_sub(freq, ax_freq): _upsample_others(ax, freq, kwargs) - ax_freq = freq else: # pragma: no cover raise ValueError('Incompatible frequency conversion') return freq, series From a154bf57b6bce147d09f63520014362a0f7a42ca Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Thu, 19 Jul 2018 23:54:33 -0700 Subject: [PATCH 2/7] Add back variable that was a check --- pandas/core/nanops.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py index 8cb8e92aea4a4..4d0f636c6d481 100644 --- a/pandas/core/nanops.py +++ b/pandas/core/nanops.py @@ -479,6 +479,9 @@ def nanvar(values, axis=None, skipna=True, ddof=1): @disallow('M8', 'm8') def nansem(values, axis=None, skipna=True, ddof=1): + # This checks if non-numeric-like data is passed with numeric_only=False + # and raises a TypeError otherwise + var = nanvar(values, axis, skipna, ddof=ddof) mask = isna(values) if not is_float_dtype(values.dtype): From b908affccdada9327ab235f33648b7e2bf31882b Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Fri, 20 Jul 2018 16:03:41 -0700 Subject: [PATCH 3/7] Remove unnecessary vars and test --- pandas/core/generic.py | 11 ++++++++--- pandas/core/indexes/category.py | 3 +-- pandas/core/internals.py | 3 +-- pandas/core/nanops.py | 2 +- pandas/core/series.py | 16 ++++++++-------- pandas/core/window.py | 4 ++-- pandas/io/formats/format.py | 4 ---- pandas/io/json/json.py | 3 +-- pandas/io/sas/sas_xport.py | 5 ----- 9 files changed, 22 insertions(+), 29 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index abaa6d24a2453..89a1743f0f186 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -1024,8 +1024,8 @@ def rename(self, *args, **kwargs): level = kwargs.pop('level', None) axis = kwargs.pop('axis', None) if axis is not None: - # TODO: axis is unused, is this just validating? - axis = self._get_axis_number(axis) + # Validate the axis + self._get_axis_number(axis) if kwargs: raise TypeError('rename() got an unexpected keyword ' @@ -5207,8 +5207,13 @@ def __copy__(self, deep=True): return self.copy(deep=deep) def __deepcopy__(self, memo=None): + """ + Parameters + ---------- + memo, default None + Standard signature. Unused + """ if memo is None: - # TODO: memo is unused memo = {} return self.copy(deep=True) diff --git a/pandas/core/indexes/category.py b/pandas/core/indexes/category.py index 39be802a7064b..34b9026267f7d 100644 --- a/pandas/core/indexes/category.py +++ b/pandas/core/indexes/category.py @@ -132,9 +132,8 @@ def _create_from_codes(self, codes, categories=None, ordered=None, ordered = self.ordered if name is None: name = self.name - # TODO: ordered above is unused. Should ordered be passed below? cat = Categorical.from_codes(codes, categories=categories, - ordered=self.ordered) + ordered=ordered) return CategoricalIndex(cat, name=name) @classmethod diff --git a/pandas/core/internals.py b/pandas/core/internals.py index eb9dfefd78624..30177a90c76df 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -1255,10 +1255,9 @@ def take_nd(self, indexer, axis, new_mgr_locs=None, fill_tuple=None): values = self.get_values() if fill_tuple is None: - # TODO: fill_value is unused; should this be passed to take_nd? fill_value = self.fill_value new_values = algos.take_nd(values, indexer, axis=axis, - allow_fill=False) + allow_fill=False, fill_value=fill_value) else: fill_value = fill_tuple[0] new_values = algos.take_nd(values, indexer, axis=axis, diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py index 4d0f636c6d481..a8e7b09d769a4 100644 --- a/pandas/core/nanops.py +++ b/pandas/core/nanops.py @@ -481,7 +481,7 @@ def nanvar(values, axis=None, skipna=True, ddof=1): def nansem(values, axis=None, skipna=True, ddof=1): # This checks if non-numeric-like data is passed with numeric_only=False # and raises a TypeError otherwise - var = nanvar(values, axis, skipna, ddof=ddof) + nanvar(values, axis, skipna, ddof=ddof) mask = isna(values) if not is_float_dtype(values.dtype): diff --git a/pandas/core/series.py b/pandas/core/series.py index 99b8935fb1ded..d7f5bcadf90e2 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2478,8 +2478,8 @@ def sort_values(self, axis=0, ascending=True, inplace=False, dtype: object """ inplace = validate_bool_kwarg(inplace, 'inplace') - # TODO: axis is unused, is this just validation? - axis = self._get_axis_number(axis) + # Valida the axis parameter + self._get_axis_number(axis) # GH 5856/5853 if inplace and self._is_cached: @@ -2651,8 +2651,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') - # TODO: axis is unused, is this just validation? - axis = self._get_axis_number(axis) + # Valida the axis parameter + self._get_axis_number(axis) index = self.index if level is not None: @@ -3073,8 +3073,8 @@ def _gotitem(self, key, ndim, subset=None): versionadded='.. versionadded:: 0.20.0', **_shared_doc_kwargs)) def aggregate(self, func, axis=0, *args, **kwargs): - # TODO: axis is unused, is this just validation? - axis = self._get_axis_number(axis) + # Valida the axis parameter + self._get_axis_number(axis) result, how = self._aggregate(func, *args, **kwargs) if result is None: @@ -3920,8 +3920,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])) - # TODO: axis is unused, is this just validation? - axis = self._get_axis_number(axis or 0) + # Valida the axis parameter + self._get_axis_number(axis or 0) if self._can_hold_na: result = remove_na_arraylike(self) diff --git a/pandas/core/window.py b/pandas/core/window.py index 1c099175a218b..b0d79e3eacdff 100644 --- a/pandas/core/window.py +++ b/pandas/core/window.py @@ -933,8 +933,8 @@ class _Rolling_and_Expanding(_Rolling): def count(self): blocks, obj, index = self._create_blocks() - # TODO: index & indexi, is this just validation? - index, indexi = self._get_index(index=index) + # Validate the index + self._get_index(index=index) window = self._get_window() window = min(window, len(obj)) if not self.center else window diff --git a/pandas/io/formats/format.py b/pandas/io/formats/format.py index 44b9fd69a0fd6..c6ca59aa08bf9 100644 --- a/pandas/io/formats/format.py +++ b/pandas/io/formats/format.py @@ -495,10 +495,6 @@ def _chk_truncate(self): frame.iloc[:, -col_num:]), axis=1) self.tr_col_num = col_num if truncate_v: - if max_rows_adj == 0: - # TODO: Should the next block be elif? row_num here will - # be overwritten. - row_num = len(frame) if max_rows_adj == 1: row_num = max_rows frame = frame.iloc[:max_rows, :] diff --git a/pandas/io/json/json.py b/pandas/io/json/json.py index 5c21556c730f7..629e00ebfa7d0 100644 --- a/pandas/io/json/json.py +++ b/pandas/io/json/json.py @@ -547,8 +547,7 @@ def _get_object_parser(self, json): if typ == 'series' or obj is None: if not isinstance(dtype, bool): - # TODO: dtype is unused. Should this be an update on kwargs? - dtype = dict(data=dtype) + kwargs['dtype'] = dtype obj = SeriesParser(json, **kwargs).parse() return obj diff --git a/pandas/io/sas/sas_xport.py b/pandas/io/sas/sas_xport.py index 6887434de91ed..14e7ad9682db6 100644 --- a/pandas/io/sas/sas_xport.py +++ b/pandas/io/sas/sas_xport.py @@ -181,11 +181,6 @@ def _parse_float_vec(vec): # number sans exponent ieee1 = xport1 & 0x00ffffff - # Get the second half of the ibm number into the second half of - # the ieee number - # TODO: This value is unused. Should it be used in the calc below? - ieee2 = xport2 - # The fraction bit to the left of the binary point in the ieee # format was set and the number was shifted 0, 1, 2, or 3 # places. This will tell us how to adjust the ibm exponent to be a From 234984a37c9263953b0d9009790e26f9eadb917c Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Fri, 20 Jul 2018 16:05:53 -0700 Subject: [PATCH 4/7] add memo docstring --- pandas/core/indexes/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 1337a350f49bd..089d9b9204c1c 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -979,7 +979,12 @@ def __copy__(self, **kwargs): return self.copy(**kwargs) def __deepcopy__(self, memo=None): - # TODO: memo is unused + """ + Parameters + ---------- + memo, default None + Standard signature. Unused + """ if memo is None: memo = {} return self.copy(deep=True) From d5ddbc1bf1a42dfbd1b7b4b659c2de8a6433cd95 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Tue, 24 Jul 2018 13:42:38 -0700 Subject: [PATCH 5/7] Misspelled Validate --- pandas/core/series.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 59d2c8c783432..693fe494b7fcc 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2473,7 +2473,7 @@ def sort_values(self, axis=0, ascending=True, inplace=False, dtype: object """ inplace = validate_bool_kwarg(inplace, 'inplace') - # Valida the axis parameter + # Validate the axis parameter self._get_axis_number(axis) # GH 5856/5853 @@ -2646,7 +2646,7 @@ 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') - # Valida the axis parameter + # Validate the axis parameter self._get_axis_number(axis) index = self.index @@ -3068,7 +3068,7 @@ def _gotitem(self, key, ndim, subset=None): versionadded='.. versionadded:: 0.20.0', **_shared_doc_kwargs)) def aggregate(self, func, axis=0, *args, **kwargs): - # Valida the axis parameter + # Validate the axis parameter self._get_axis_number(axis) result, how = self._aggregate(func, *args, **kwargs) if result is None: @@ -3915,7 +3915,7 @@ def dropna(self, axis=0, inplace=False, **kwargs): if kwargs: raise TypeError('dropna() got an unexpected keyword ' 'argument "{0}"'.format(list(kwargs.keys())[0])) - # Valida the axis parameter + # Validate the axis parameter self._get_axis_number(axis or 0) if self._can_hold_na: From 0d7f07783ad9a42bb3fc7f0e3dda0c01b877fe57 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Wed, 25 Jul 2018 17:27:42 -0700 Subject: [PATCH 6/7] Add test for modified behavior --- pandas/tests/io/json/test_pandas.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index bcbac4400c953..c5888592624c0 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -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): + # GH 21986 + s = Series([4.56, 4.56, 4.56]) + result = read_json(s.to_json(), typ='series', dtype=int) + 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) From 8492e931bd1ce8a1dd4f50efaf2b2fbfccb4e2dd Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Thu, 26 Jul 2018 09:48:34 -0700 Subject: [PATCH 7/7] Use np.int64 for windows --- pandas/tests/io/json/test_pandas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index c5888592624c0..d6e7c644cc780 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -645,7 +645,7 @@ def test_series_from_json_precise_float(self): def test_series_with_dtype(self): # GH 21986 s = Series([4.56, 4.56, 4.56]) - result = read_json(s.to_json(), typ='series', dtype=int) + result = read_json(s.to_json(), typ='series', dtype=np.int64) expected = Series([4] * 3) assert_series_equal(result, expected)