Skip to content

Commit d0df3bd

Browse files
committed
Merge remote-tracking branch 'upstream/master' into libreoffice-support
2 parents 8302fd7 + 989f912 commit d0df3bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+503
-264
lines changed

doc/source/user_guide/io.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3393,15 +3393,15 @@ both on the writing (serialization), and reading (deserialization).
33933393

33943394
.. warning::
33953395

3396-
This is a very new feature of pandas. We intend to provide certain
3397-
optimizations in the io of the ``msgpack`` data. Since this is marked
3398-
as an EXPERIMENTAL LIBRARY, the storage format may not be stable until a future release.
3396+
The msgpack format is deprecated as of 0.25 and will be removed in a future version.
3397+
It is recommended to use pyarrow for on-the-wire transmission of pandas objects.
33993398

34003399
.. warning::
34013400

34023401
:func:`read_msgpack` is only guaranteed backwards compatible back to pandas version 0.20.3
34033402

34043403
.. ipython:: python
3404+
:okwarning:
34053405
34063406
df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB'))
34073407
df.to_msgpack('foo.msg')
@@ -3411,20 +3411,23 @@ both on the writing (serialization), and reading (deserialization).
34113411
You can pass a list of objects and you will receive them back on deserialization.
34123412

34133413
.. ipython:: python
3414+
:okwarning:
34143415
34153416
pd.to_msgpack('foo.msg', df, 'foo', np.array([1, 2, 3]), s)
34163417
pd.read_msgpack('foo.msg')
34173418
34183419
You can pass ``iterator=True`` to iterate over the unpacked results:
34193420

34203421
.. ipython:: python
3422+
:okwarning:
34213423
34223424
for o in pd.read_msgpack('foo.msg', iterator=True):
34233425
print(o)
34243426
34253427
You can pass ``append=True`` to the writer to append to an existing pack:
34263428

34273429
.. ipython:: python
3430+
:okwarning:
34283431
34293432
df.to_msgpack('foo.msg', append=True)
34303433
pd.read_msgpack('foo.msg')
@@ -3435,6 +3438,7 @@ can pack arbitrary collections of Python lists, dicts, scalars, while intermixin
34353438
pandas objects.
34363439

34373440
.. ipython:: python
3441+
:okwarning:
34383442
34393443
pd.to_msgpack('foo2.msg', {'dict': [{'df': df}, {'string': 'foo'},
34403444
{'scalar': 1.}, {'s': s}]})
@@ -3453,14 +3457,16 @@ Read/write API
34533457
Msgpacks can also be read from and written to strings.
34543458

34553459
.. ipython:: python
3460+
:okwarning:
34563461
34573462
df.to_msgpack()
34583463
34593464
Furthermore you can concatenate the strings to produce a list of the original objects.
34603465

34613466
.. ipython:: python
3467+
:okwarning:
34623468
3463-
pd.read_msgpack(df.to_msgpack() + s.to_msgpack())
3469+
pd.read_msgpack(df.to_msgpack() + s.to_msgpack())
34643470
34653471
.. _io.hdf5:
34663472

doc/source/whatsnew/v0.13.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ Experimental
829829
Since this is an EXPERIMENTAL LIBRARY, the storage format may not be stable until a future release.
830830

831831
.. ipython:: python
832+
:okwarning:
832833
833834
df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB'))
834835
df.to_msgpack('foo.msg')
@@ -841,6 +842,7 @@ Experimental
841842
You can pass ``iterator=True`` to iterator over the unpacked results
842843

843844
.. ipython:: python
845+
:okwarning:
844846
845847
for o in pd.read_msgpack('foo.msg', iterator=True):
846848
print(o)

doc/source/whatsnew/v0.24.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ Deprecations
12981298
- :meth:`Series.compress` is deprecated. Use ``Series[condition]`` instead (:issue:`18262`)
12991299
- The signature of :meth:`Series.to_csv` has been uniformed to that of :meth:`DataFrame.to_csv`: the name of the first argument is now ``path_or_buf``, the order of subsequent arguments has changed, the ``header`` argument now defaults to ``True``. (:issue:`19715`)
13001300
- :meth:`Categorical.from_codes` has deprecated providing float values for the ``codes`` argument. (:issue:`21767`)
1301-
- :func:`pandas.read_table` is deprecated. Instead, use :func:`read_csv` passing ``sep='\t'`` if necessary (:issue:`21948`)
1301+
- :func:`pandas.read_table` is deprecated. Instead, use :func:`read_csv` passing ``sep='\t'`` if necessary. This deprecation has been removed in 0.25.0. (:issue:`21948`)
13021302
- :meth:`Series.str.cat` has deprecated using arbitrary list-likes *within* list-likes. A list-like container may still contain
13031303
many ``Series``, ``Index`` or 1-dimensional ``np.ndarray``, or alternatively, only scalar values. (:issue:`21950`)
13041304
- :meth:`FrozenNDArray.searchsorted` has deprecated the ``v`` parameter in favor of ``value`` (:issue:`14645`)

doc/source/whatsnew/v0.25.0.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ Other enhancements
159159
- Added support for reading SPSS .sav files using :func:`read_spss` (:issue:`26537`)
160160
- Added new option ``plotting.backend`` to be able to select a plotting backend different than the existing ``matplotlib`` one. Use ``pandas.set_option('plotting.backend', '<backend-module>')`` where ``<backend-module`` is a library implementing the pandas plotting API (:issue:`14130`)
161161
- :class:`pandas.offsets.BusinessHour` supports multiple opening hours intervals (:issue:`15481`)
162-
- :func:`pandas.io.excel.read_excel` supports reading OpenDocument tables. Specify engine='odf' to enable. (:issue:`9070`)
162+
- :func:`read_excel` can now use ``openpyxl`` to read Excel files via the ``engine='openpyxl'`` argument. This will become the default in a future release (:issue:`11499`)
163+
- :func:`pandas.io.excel.read_excel` supports reading OpenDocument tables. Specify engine='odf' to enable. (:issue:`9070`)
163164

164165
.. _whatsnew_0250.api_breaking:
165166

@@ -590,6 +591,12 @@ by a ``Series`` or ``DataFrame`` with sparse values.
590591
591592
The memory usage of the two approaches is identical. See :ref:`sparse.migration` for more (:issue:`19239`).
592593

594+
msgpack format
595+
^^^^^^^^^^^^^^
596+
597+
The msgpack format is deprecated as of 0.25 and will be removed in a future version. It is recommended to use pyarrow for on-the-wire transmission of pandas objects. (:issue:`27084`)
598+
599+
593600
Other deprecations
594601
^^^^^^^^^^^^^^^^^^
595602

@@ -604,6 +611,11 @@ Other deprecations
604611
- The :meth:`Series.ftype`, :meth:`Series.ftypes` and :meth:`DataFrame.ftypes` methods are deprecated and will be removed in a future version.
605612
Instead, use :meth:`Series.dtype` and :meth:`DataFrame.dtypes` (:issue:`26705`).
606613
- :meth:`Timedelta.resolution` is deprecated and replaced with :meth:`Timedelta.resolution_string`. In a future version, :meth:`Timedelta.resolution` will be changed to behave like the standard library :attr:`timedelta.resolution` (:issue:`21344`)
614+
- :func:`read_table` has been undeprecated. (:issue:`25220`)
615+
- :attr:`Index.dtype_str` is deprecated. (:issue:`18262`)
616+
- :attr:`Series.imag` and :attr:`Series.real` are deprecated. (:issue:`18262`)
617+
- :meth:`Series.put` is deprecated. (:issue:`18262`)
618+
- :meth:`Index.item` and :meth:`Series.item` is deprecated. (:issue:`18262`)
607619

608620
.. _whatsnew_0250.prior_deprecations:
609621

mypy.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[mypy]
22
ignore_missing_imports=True
3+
no_implicit_optional=True
34

45
[mypy-pandas.conftest,pandas.tests.*]
56
ignore_errors=True

pandas/_typing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
FilePathOrBuffer = Union[str, Path, IO[AnyStr]]
2525

2626
FrameOrSeries = TypeVar('FrameOrSeries', ABCSeries, ABCDataFrame)
27+
Scalar = Union[str, int, float]

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def ordered(self):
435435
return self.dtype.ordered
436436

437437
@property
438-
def dtype(self):
438+
def dtype(self) -> CategoricalDtype:
439439
"""
440440
The :class:`~pandas.api.types.CategoricalDtype` for this instance
441441
"""
@@ -1989,9 +1989,7 @@ def _repr_categories_info(self):
19891989
"""
19901990

19911991
category_strs = self._repr_categories()
1992-
dtype = getattr(self.categories, 'dtype_str',
1993-
str(self.categories.dtype))
1994-
1992+
dtype = str(self.categories.dtype)
19951993
levheader = "Categories ({length}, {dtype}): ".format(
19961994
length=len(self.categories), dtype=dtype)
19971995
width, height = get_terminal_size()

pandas/core/arrays/period.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _simple_new(cls, values, freq=None, **kwargs):
195195
def _from_sequence(
196196
cls,
197197
scalars: Sequence[Optional[Period]],
198-
dtype: PeriodDtype = None,
198+
dtype: Optional[PeriodDtype] = None,
199199
copy: bool = False,
200200
) -> ABCPeriodArray:
201201
if dtype:

pandas/core/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,15 @@ def item(self):
693693
"""
694694
Return the first element of the underlying data as a python scalar.
695695
696+
.. deprecated 0.25.0
697+
696698
Returns
697699
-------
698700
scalar
699701
The first element of %(klass)s.
700702
"""
703+
warnings.warn('`item` has been deprecated and will be removed in a '
704+
'future version', FutureWarning, stacklevel=2)
701705
return self.values.item()
702706

703707
@property

pandas/core/config_init.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,43 @@ def use_inf_as_na_cb(key):
411411
cf.register_option('chained_assignment', 'warn', chained_assignment,
412412
validator=is_one_of_factory([None, 'warn', 'raise']))
413413

414-
# Set up the io.excel specific configuration.
414+
415+
# Set up the io.excel specific reader configuration.
416+
reader_engine_doc = """
417+
: string
418+
The default Excel reader engine for '{ext}' files. Available options:
419+
auto, {others}.
420+
"""
421+
422+
_xls_options = ['xlrd']
423+
_xlsm_options = ['xlrd', 'openpyxl']
424+
_xlsx_options = ['xlrd', 'openpyxl']
425+
426+
427+
with cf.config_prefix("io.excel.xls"):
428+
cf.register_option("reader", "auto",
429+
reader_engine_doc.format(
430+
ext='xls',
431+
others=', '.join(_xls_options)),
432+
validator=str)
433+
434+
with cf.config_prefix("io.excel.xlsm"):
435+
cf.register_option("reader", "auto",
436+
reader_engine_doc.format(
437+
ext='xlsm',
438+
others=', '.join(_xlsm_options)),
439+
validator=str)
440+
441+
442+
with cf.config_prefix("io.excel.xlsx"):
443+
cf.register_option("reader", "auto",
444+
reader_engine_doc.format(
445+
ext='xlsx',
446+
others=', '.join(_xlsx_options)),
447+
validator=str)
448+
449+
450+
# Set up the io.excel specific writer configuration.
415451
writer_engine_doc = """
416452
: string
417453
The default Excel writer engine for '{ext}' files. Available options:

0 commit comments

Comments
 (0)