diff --git a/.binstar.yml b/.binstar.yml deleted file mode 100644 index 7b507b4f90049..0000000000000 --- a/.binstar.yml +++ /dev/null @@ -1,28 +0,0 @@ -package: pandas -user: jreback - -install: - - conda config --add channels pandas - -before_script: - - python -V - -platform: - - linux-64 - #- linux-32 - - osx-64 - #- win-32 - - win-64 -engine: - - python=2.7 - - python=3.4 -script: - - conda build conda.recipe --quiet - -iotimeout: 600 - -build_targets: conda - -notifications: - email: - recipients: ['jeff@reback.net'] diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 9694289fc22d5..2a0302c92e34a 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -580,8 +580,8 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more. - :meth:`Series.where` with ``Categorical`` dtype (or :meth:`DataFrame.where` with ``Categorical`` column) no longer allows setting new categories (:issue:`24114`) - :class:`DatetimeIndex`, :class:`TimedeltaIndex`, and :class:`PeriodIndex` constructors no longer allow ``start``, ``end``, and ``periods`` keywords, use :func:`date_range`, :func:`timedelta_range`, and :func:`period_range` instead (:issue:`23919`) - :class:`DatetimeIndex` and :class:`TimedeltaIndex` constructors no longer have a ``verify_integrity`` keyword argument (:issue:`23919`) -- ``pandas.core.internals.blocks.make_block`` no longer accepts the "fastpath" keyword(:issue:`19265`) -- :meth:`Block.make_block_same_class` no longer accepts the "dtype" keyword(:issue:`19434`) +- ``pandas.core.internals.blocks.make_block`` no longer accepts the "fastpath" keyword (:issue:`19265`) +- :meth:`Block.make_block_same_class` no longer accepts the "dtype" keyword (:issue:`19434`) - Removed the previously deprecated :meth:`ExtensionArray._formatting_values`. Use :attr:`ExtensionArray._formatter` instead. (:issue:`23601`) - Removed the previously deprecated :meth:`MultiIndex.to_hierarchical` (:issue:`21613`) - Removed the previously deprecated :attr:`MultiIndex.labels`, use :attr:`MultiIndex.codes` instead (:issue:`23752`) diff --git a/pandas/_libs/reshape.pyx b/pandas/_libs/reshape.pyx index 32aa936672aab..4e831081c8e54 100644 --- a/pandas/_libs/reshape.pyx +++ b/pandas/_libs/reshape.pyx @@ -28,7 +28,7 @@ def unstack(reshape_t[:, :] values, uint8_t[:] mask, Py_ssize_t stride, Py_ssize_t length, Py_ssize_t width, reshape_t[:, :] new_values, uint8_t[:, :] new_mask): """ - transform long sorted_values to wide new_values + Transform long values to wide new_values. Parameters ---------- diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 10669b09cefec..1d4052ad8b114 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -802,8 +802,8 @@ def _add_offset(self, offset): PerformanceWarning, ) result = self.astype("O") + offset - if len(self) == 0: - # _from_sequence won't be able to infer self.tz + if not len(self): + # GH#30336 _from_sequence won't be able to infer self.tz return type(self)._from_sequence(result).tz_localize(self.tz) return type(self)._from_sequence(result, freq="infer") diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index a81209229a3b8..d15a95191745b 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -741,16 +741,17 @@ def copy(self, deep=True): Parameters ---------- - deep : boolean o rstring, default True + deep : bool or string, default True If False, return shallow copy (do not copy data) If 'all', copy data and a deep copy of the index Returns ------- - copy : BlockManager + BlockManager """ # this preserves the notion of view copying of axes if deep: + # hit in e.g. tests.io.json.test_pandas def copy_func(ax): if deep == "all": @@ -761,6 +762,7 @@ def copy_func(ax): new_axes = [copy_func(ax) for ax in self.axes] else: new_axes = list(self.axes) + res = self.apply("copy", deep=deep) res.axes = new_axes return res diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index c628a0d2bdf2e..3235001e14dff 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -2204,8 +2204,6 @@ class PythonParser(ParserBase): def __init__(self, f, **kwds): """ Workhorse function for processing nested list into DataFrame - - Should be replaced by np.genfromtxt eventually? """ ParserBase.__init__(self, kwds) diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index 2a6da18096c84..6da13f188357c 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -241,12 +241,6 @@ def _iter_data(self, data=None, keep_index=False, fillna=None): if fillna is not None: data = data.fillna(fillna) - # TODO: unused? - # if self.sort_columns: - # columns = com.try_sort(data.columns) - # else: - # columns = data.columns - for col, values in data.items(): if keep_index is True: yield col, values diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index e8b6491c5026c..8438eea84baa8 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -1206,25 +1206,33 @@ def test_truediv(self): ex = "s / 1" d = {"s": s} # noqa - res = self.eval(ex, truediv=False) + # FutureWarning: The `truediv` parameter in pd.eval is deprecated and will be + # removed in a future version. + with tm.assert_produces_warning(FutureWarning): + res = self.eval(ex, truediv=False) tm.assert_numpy_array_equal(res, np.array([1.0])) - res = self.eval(ex, truediv=True) + with tm.assert_produces_warning(FutureWarning): + res = self.eval(ex, truediv=True) tm.assert_numpy_array_equal(res, np.array([1.0])) - res = self.eval("1 / 2", truediv=True) + with tm.assert_produces_warning(FutureWarning): + res = self.eval("1 / 2", truediv=True) expec = 0.5 assert res == expec - res = self.eval("1 / 2", truediv=False) + with tm.assert_produces_warning(FutureWarning): + res = self.eval("1 / 2", truediv=False) expec = 0.5 assert res == expec - res = self.eval("s / 2", truediv=False) + with tm.assert_produces_warning(FutureWarning): + res = self.eval("s / 2", truediv=False) expec = 0.5 assert res == expec - res = self.eval("s / 2", truediv=True) + with tm.assert_produces_warning(FutureWarning): + res = self.eval("s / 2", truediv=True) expec = 0.5 assert res == expec diff --git a/pandas/tests/dtypes/test_inference.py b/pandas/tests/dtypes/test_inference.py index f34a6effcc4f5..343dcc6849af6 100644 --- a/pandas/tests/dtypes/test_inference.py +++ b/pandas/tests/dtypes/test_inference.py @@ -4,6 +4,7 @@ """ import collections +from collections import namedtuple from datetime import date, datetime, time, timedelta from decimal import Decimal from fractions import Fraction @@ -1123,18 +1124,13 @@ def test_is_string_array(self): def test_to_object_array_tuples(self): r = (5, 6) values = [r] - result = lib.to_object_array_tuples(values) + lib.to_object_array_tuples(values) - try: - # make sure record array works - from collections import namedtuple - - record = namedtuple("record", "x y") - r = record(5, 6) - values = [r] - result = lib.to_object_array_tuples(values) # noqa - except ImportError: - pass + # make sure record array works + record = namedtuple("record", "x y") + r = record(5, 6) + values = [r] + lib.to_object_array_tuples(values) def test_object(self): @@ -1174,8 +1170,6 @@ def test_is_period(self): def test_categorical(self): # GH 8974 - from pandas import Categorical, Series - arr = Categorical(list("abc")) result = lib.infer_dtype(arr, skipna=True) assert result == "categorical" diff --git a/pandas/tests/extension/test_numpy.py b/pandas/tests/extension/test_numpy.py index 221cf0787d839..beb3fc80eccd6 100644 --- a/pandas/tests/extension/test_numpy.py +++ b/pandas/tests/extension/test_numpy.py @@ -51,7 +51,7 @@ def data_missing(allow_in_pandas, dtype): if dtype.numpy_dtype == "object": if _np_version_under1p16: raise pytest.skip("Skipping for NumPy <1.16") - return PandasArray(np.array([np.nan, (1,)])) + return PandasArray(np.array([np.nan, (1,)], dtype=object)) return PandasArray(np.array([np.nan, 1.0])) @@ -78,7 +78,7 @@ def data_for_sorting(allow_in_pandas, dtype): if dtype.numpy_dtype == "object": # Use an empty tuple for first element, then remove, # to disable np.array's shape inference. - return PandasArray(np.array([(), (2,), (3,), (1,)])[1:]) + return PandasArray(np.array([(), (2,), (3,), (1,)], dtype=object)[1:]) return PandasArray(np.array([1, 2, 0])) @@ -90,7 +90,7 @@ def data_missing_for_sorting(allow_in_pandas, dtype): A < B and NA missing. """ if dtype.numpy_dtype == "object": - return PandasArray(np.array([(1,), np.nan, (0,)])) + return PandasArray(np.array([(1,), np.nan, (0,)], dtype=object)) return PandasArray(np.array([1, np.nan, 0])) @@ -106,7 +106,9 @@ def data_for_grouping(allow_in_pandas, dtype): a, b, c = (1,), (2,), (3,) else: a, b, c = np.arange(3) - return PandasArray(np.array([b, b, np.nan, np.nan, a, a, b, c])) + return PandasArray( + np.array([b, b, np.nan, np.nan, a, a, b, c], dtype=dtype.numpy_dtype) + ) @pytest.fixture diff --git a/pandas/tests/frame/methods/test_to_records.py b/pandas/tests/frame/methods/test_to_records.py index eb69e8b297a6a..18f77088677ec 100644 --- a/pandas/tests/frame/methods/test_to_records.py +++ b/pandas/tests/frame/methods/test_to_records.py @@ -74,7 +74,7 @@ def test_to_records_with_unicode_index(self): tm.assert_almost_equal(result, expected) def test_to_records_with_unicode_column_names(self): - # xref GH#2407 + # xref issue: https://github.com/numpy/numpy/issues/2407 # Issue GH#11879. to_records used to raise an exception when used # with column names containing non-ascii characters in Python 2 result = DataFrame(data={"accented_name_é": [1.0]}).to_records()