Skip to content

Commit

Permalink
DEPR: enforce deprecations in core.internals (#29723)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and jreback committed Nov 22, 2019
1 parent 768b27f commit 816f3df
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 38 deletions.
2 changes: 1 addition & 1 deletion ci/deps/azure-windows-36.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
# pandas dependencies
- blosc
- bottleneck
- fastparquet>=0.2.1
- fastparquet>=0.3.2
- matplotlib=3.0.2
- numexpr
- numpy=1.15.*
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-36-cov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
- botocore>=1.11
- cython>=0.29.13
- dask
- fastparquet>=0.2.1
- fastparquet>=0.3.2
- gcsfs
- geopandas
- html5lib
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-36-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- beautifulsoup4
- blosc=1.14.3
- python-blosc
- fastparquet=0.2.1
- fastparquet=0.3.2
- gcsfs=0.2.2
- html5lib
- ipython
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ SQLAlchemy 1.1.4 SQL support for databases other tha
SciPy 0.19.0 Miscellaneous statistical functions
XLsxWriter 0.9.8 Excel writing
blosc Compression for msgpack
fastparquet 0.2.1 Parquet reading / writing
fastparquet 0.3.2 Parquet reading / writing
gcsfs 0.2.2 Google Cloud Storage access
html5lib HTML parser for read_html (see :ref:`note <optional_html>`)
lxml 3.8.0 HTML parser for read_html (see :ref:`note <optional_html>`)
Expand Down
67 changes: 67 additions & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,71 @@ The following methods now also correctly output values for unobserved categories
df.groupby(["cat_1", "cat_2"], observed=False)["value"].count()
.. _whatsnew_1000.api_breaking.deps:

Increased minimum versions for dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Some minimum supported versions of dependencies were updated (:issue:`29723`).
If installed, we now require:

+-----------------+-----------------+----------+
| Package | Minimum Version | Required |
+=================+=================+==========+
| numpy | 1.13.3 | X |
+-----------------+-----------------+----------+
| pytz | 2015.4 | X |
+-----------------+-----------------+----------+
| python-dateutil | 2.6.1 | X |
+-----------------+-----------------+----------+
| bottleneck | 1.2.1 | |
+-----------------+-----------------+----------+
| numexpr | 2.6.2 | |
+-----------------+-----------------+----------+
| pytest (dev) | 4.0.2 | |
+-----------------+-----------------+----------+

For `optional libraries <https://dev.pandas.io/docs/install.html#dependencies>`_ the general recommendation is to use the latest version.
The following table lists the lowest version per library that is currently being tested throughout the development of pandas.
Optional libraries below the lowest tested version may still work, but are not considered supported.

+-----------------+-----------------+
| Package | Minimum Version |
+=================+=================+
| beautifulsoup4 | 4.6.0 |
+-----------------+-----------------+
| fastparquet | 0.3.2 |
+-----------------+-----------------+
| gcsfs | 0.2.2 |
+-----------------+-----------------+
| lxml | 3.8.0 |
+-----------------+-----------------+
| matplotlib | 2.2.2 |
+-----------------+-----------------+
| openpyxl | 2.4.8 |
+-----------------+-----------------+
| pyarrow | 0.9.0 |
+-----------------+-----------------+
| pymysql | 0.7.1 |
+-----------------+-----------------+
| pytables | 3.4.2 |
+-----------------+-----------------+
| scipy | 0.19.0 |
+-----------------+-----------------+
| sqlalchemy | 1.1.4 |
+-----------------+-----------------+
| xarray | 0.8.2 |
+-----------------+-----------------+
| xlrd | 1.1.0 |
+-----------------+-----------------+
| xlsxwriter | 0.9.8 |
+-----------------+-----------------+
| xlwt | 1.2.0 |
+-----------------+-----------------+

See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.


.. _whatsnew_1000.api.other:

Other API changes
Expand Down Expand Up @@ -321,6 +386,8 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
- Removed :meth:`DataFrame.as_blocks`, :meth:`Series.as_blocks`, `DataFrame.blocks`, :meth:`Series.blocks` (:issue:`17656`)
- :meth:`pandas.Series.str.cat` now defaults to aligning ``others``, using ``join='left'`` (:issue:`27611`)
- :meth:`pandas.Series.str.cat` does not accept list-likes *within* list-likes anymore (:issue:`27611`)
- :func:`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 support for legacy HDF5 formats (:issue:`29787`)
- :func:`read_excel` removed support for "skip_footer" argument, use "skipfooter" instead (:issue:`18836`)
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies:

# optional for io
- beautifulsoup4>=4.6.0 # pandas.read_html
- fastparquet>=0.2.1 # pandas.read_parquet, DataFrame.to_parquet
- fastparquet>=0.3.2 # pandas.read_parquet, DataFrame.to_parquet
- html5lib # pandas.read_html
- lxml # pandas.read_html
- openpyxl # pandas.read_excel, DataFrame.to_excel, pandas.ExcelWriter, pandas.ExcelFile
Expand Down
2 changes: 1 addition & 1 deletion pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
VERSIONS = {
"bs4": "4.6.0",
"bottleneck": "1.2.1",
"fastparquet": "0.2.1",
"fastparquet": "0.3.2",
"gcsfs": "0.2.2",
"lxml.etree": "3.8.0",
"matplotlib": "2.2.2",
Expand Down
20 changes: 3 additions & 17 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,13 @@ def make_block(self, values, placement=None):

return make_block(values, placement=placement, ndim=self.ndim)

def make_block_same_class(self, values, placement=None, ndim=None, dtype=None):
def make_block_same_class(self, values, placement=None, ndim=None):
""" Wrap given values in a block of same type as self. """
if dtype is not None:
# issue 19431 fastparquet is passing this
warnings.warn(
"dtype argument is deprecated, will be removed in a future release.",
FutureWarning,
)
if placement is None:
placement = self.mgr_locs
if ndim is None:
ndim = self.ndim
return make_block(
values, placement=placement, ndim=ndim, klass=self.__class__, dtype=dtype
)
return make_block(values, placement=placement, ndim=ndim, klass=self.__class__)

def __repr__(self) -> str:
# don't want to print out all of the items here
Expand Down Expand Up @@ -3001,7 +2993,7 @@ def get_block_type(values, dtype=None):
return cls


def make_block(values, placement, klass=None, ndim=None, dtype=None, fastpath=None):
def make_block(values, placement, klass=None, ndim=None, dtype=None):
# Ensure that we don't allow PandasArray / PandasDtype in internals.
# For now, blocks should be backed by ndarrays when possible.
if isinstance(values, ABCPandasArray):
Expand All @@ -3012,12 +3004,6 @@ def make_block(values, placement, klass=None, ndim=None, dtype=None, fastpath=No
if isinstance(dtype, PandasDtype):
dtype = dtype.numpy_dtype

if fastpath is not None:
# GH#19265 pyarrow is passing this
warnings.warn(
"fastpath argument is deprecated, will be removed in a future release.",
FutureWarning,
)
if klass is None:
dtype = dtype or values.dtype
klass = get_block_type(values, dtype)
Expand Down
13 changes: 0 additions & 13 deletions pandas/tests/internals/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,6 @@ def test_delete(self):
with pytest.raises(Exception):
newb.delete(3)

def test_make_block_same_class(self):
# issue 19431
block = create_block("M8[ns, US/Eastern]", [3])
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
block.make_block_same_class(block.values, dtype=block.values.dtype)


class TestDatetimeBlock:
def test_can_hold_element(self):
Expand Down Expand Up @@ -1255,13 +1249,6 @@ def test_holder(typestr, holder):
assert blk._holder is holder


def test_deprecated_fastpath():
# GH#19265
values = np.random.rand(3, 3)
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
make_block(values, placement=np.arange(3), fastpath=True)


def test_validate_ndim():
values = np.array([1.0, 2.0])
placement = slice(2)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def test_additional_extension_arrays(self, pa):


class TestParquetFastParquet(Base):
@td.skip_if_no("fastparquet", min_version="0.2.1")
@td.skip_if_no("fastparquet", min_version="0.3.2")
def test_basic(self, fp, df_full):
df = df_full

Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ matplotlib>=2.2.2
numexpr>=2.6.8
scipy>=1.1
beautifulsoup4>=4.6.0
fastparquet>=0.2.1
fastparquet>=0.3.2
html5lib
lxml
openpyxl
Expand Down

0 comments on commit 816f3df

Please sign in to comment.