Skip to content

Commit 2b5e525

Browse files
committed
Merge pull request #5001 from jreback/remove_set_printoptions
API: Remove set_printoptions/reset_printoptions (:issue:3046)
2 parents 6260e29 + ba00973 commit 2b5e525

File tree

9 files changed

+13
-96
lines changed

9 files changed

+13
-96
lines changed

doc/source/basics.rst

+5-10
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ Methods like ``replace`` and ``findall`` take regular expressions, too:
983983
s3.str.replace('^.a|dog', 'XX-XX ', case=False)
984984
985985
The method ``match`` returns the groups in a regular expression in one tuple.
986-
Starting in pandas version 0.13, the method ``extract`` is available to
986+
Starting in pandas version 0.13, the method ``extract`` is available to
987987
accomplish this more conveniently.
988988

989989
Extracting a regular expression with one group returns a Series of strings.
@@ -992,16 +992,16 @@ Extracting a regular expression with one group returns a Series of strings.
992992
993993
Series(['a1', 'b2', 'c3']).str.extract('[ab](\d)')
994994
995-
Elements that do not match return ``NaN``. Extracting a regular expression
995+
Elements that do not match return ``NaN``. Extracting a regular expression
996996
with more than one group returns a DataFrame with one column per group.
997997

998998
.. ipython:: python
999999
10001000
Series(['a1', 'b2', 'c3']).str.extract('([ab])(\d)')
10011001
1002-
Elements that do not match return a row of ``NaN``s.
1003-
Thus, a Series of messy strings can be "converted" into a
1004-
like-indexed Series or DataFrame of cleaned-up or more useful strings,
1002+
Elements that do not match return a row of ``NaN``s.
1003+
Thus, a Series of messy strings can be "converted" into a
1004+
like-indexed Series or DataFrame of cleaned-up or more useful strings,
10051005
without necessitating ``get()`` to access tuples or ``re.match`` objects.
10061006

10071007
Named groups like
@@ -1411,11 +1411,6 @@ Console Output Formatting
14111411

14121412
.. _basics.console_output:
14131413

1414-
**Note:** ``set_printoptions``/ ``reset_printoptions`` are now deprecated (but functioning),
1415-
and both, as well as ``set_eng_float_format``, use the options API behind the scenes.
1416-
The corresponding options now live under "print.XYZ", and you can set them directly with
1417-
``get/set_option``.
1418-
14191414
Use the ``set_eng_float_format`` function in the ``pandas.core.common`` module
14201415
to alter the floating-point formatting of pandas objects to produce a particular
14211416
format.

doc/source/release.rst

+2
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ API Changes
237237
on indexes on non ``Float64Index`` will raise a ``TypeError``, e.g. ``Series(range(5))[3.5:4.5]`` (:issue:`263`)
238238
- Make Categorical repr nicer (:issue:`4368`)
239239
- Remove deprecated ``Factor`` (:issue:`3650`)
240+
- Remove deprecated ``set_printoptions/reset_printoptions`` (:issue:``3046``)
241+
- Remove deprecated ``_verbose_info`` (:issue:`3215`)
240242

241243
Internal Refactoring
242244
~~~~~~~~~~~~~~~~~~~~

doc/source/v0.13.0.txt

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ API changes
6868
df1 and df2
6969
s1 and s2
7070

71+
- Remove deprecated ``Factor`` (:issue:`3650`)
72+
- Remove deprecated ``set_printoptions/reset_printoptions`` (:issue:``3046``)
73+
- Remove deprecated ``_verbose_info`` (:issue:`3215`)
74+
7175
Indexing API Changes
7276
~~~~~~~~~~~~~~~~~~~~
7377

pandas/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# XXX: HACK for NumPy 1.5.1 to suppress warnings
2222
try:
2323
np.seterr(all='ignore')
24-
# np.set_printoptions(suppress=True)
2524
except Exception: # pragma: no cover
2625
pass
2726

pandas/core/api.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
from pandas.core.algorithms import factorize, match, unique, value_counts
77
from pandas.core.common import isnull, notnull
88
from pandas.core.categorical import Categorical
9-
from pandas.core.format import (set_printoptions, reset_printoptions,
10-
set_eng_float_format)
9+
from pandas.core.format import set_eng_float_format
1110
from pandas.core.index import Index, Int64Index, Float64Index, MultiIndex
1211

1312
from pandas.core.series import Series, TimeSeries

pandas/core/format.py

+1-73
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
multiindex key at each row, default True
5050
justify : {'left', 'right'}, default None
5151
Left or right-justify the column labels. If None uses the option from
52-
the print configuration (controlled by set_printoptions), 'right' out
52+
the print configuration (controlled by set_option), 'right' out
5353
of the box.
5454
index_names : bool, optional
5555
Prints the names of the indexes, default True
@@ -1669,78 +1669,6 @@ def _has_names(index):
16691669
#------------------------------------------------------------------------------
16701670
# Global formatting options
16711671

1672-
1673-
def set_printoptions(precision=None, column_space=None, max_rows=None,
1674-
max_columns=None, colheader_justify=None,
1675-
max_colwidth=None, notebook_repr_html=None,
1676-
date_dayfirst=None, date_yearfirst=None,
1677-
pprint_nest_depth=None, multi_sparse=None, encoding=None):
1678-
"""
1679-
Alter default behavior of DataFrame.toString
1680-
1681-
precision : int
1682-
Floating point output precision (number of significant digits). This is
1683-
only a suggestion
1684-
column_space : int
1685-
Default space for DataFrame columns, defaults to 12
1686-
max_rows : int
1687-
max_columns : int
1688-
max_rows and max_columns are used in __repr__() methods to decide if
1689-
to_string() or info() is used to render an object to a string.
1690-
Either one, or both can be set to 0 (experimental). Pandas will figure
1691-
out how big the terminal is and will not display more rows or/and
1692-
columns that can fit on it.
1693-
colheader_justify
1694-
notebook_repr_html : boolean
1695-
When True (default), IPython notebook will use html representation for
1696-
pandas objects (if it is available).
1697-
date_dayfirst : boolean
1698-
When True, prints and parses dates with the day first, eg 20/01/2005
1699-
date_yearfirst : boolean
1700-
When True, prints and parses dates with the year first, eg 2005/01/20
1701-
pprint_nest_depth : int
1702-
Defaults to 3.
1703-
Controls the number of nested levels to process when pretty-printing
1704-
nested sequences.
1705-
multi_sparse : boolean
1706-
Default True, "sparsify" MultiIndex display (don't display repeated
1707-
elements in outer levels within groups)
1708-
"""
1709-
import warnings
1710-
warnings.warn("set_printoptions is deprecated, use set_option instead",
1711-
FutureWarning)
1712-
if precision is not None:
1713-
set_option("display.precision", precision)
1714-
if column_space is not None:
1715-
set_option("display.column_space", column_space)
1716-
if max_rows is not None:
1717-
set_option("display.max_rows", max_rows)
1718-
if max_colwidth is not None:
1719-
set_option("display.max_colwidth", max_colwidth)
1720-
if max_columns is not None:
1721-
set_option("display.max_columns", max_columns)
1722-
if colheader_justify is not None:
1723-
set_option("display.colheader_justify", colheader_justify)
1724-
if notebook_repr_html is not None:
1725-
set_option("display.notebook_repr_html", notebook_repr_html)
1726-
if date_dayfirst is not None:
1727-
set_option("display.date_dayfirst", date_dayfirst)
1728-
if date_yearfirst is not None:
1729-
set_option("display.date_yearfirst", date_yearfirst)
1730-
if pprint_nest_depth is not None:
1731-
set_option("display.pprint_nest_depth", pprint_nest_depth)
1732-
if multi_sparse is not None:
1733-
set_option("display.multi_sparse", multi_sparse)
1734-
if encoding is not None:
1735-
set_option("display.encoding", encoding)
1736-
1737-
1738-
def reset_printoptions():
1739-
import warnings
1740-
warnings.warn("reset_printoptions is deprecated, use reset_option instead",
1741-
FutureWarning)
1742-
reset_option("^display\.")
1743-
17441672
_initial_defencoding = None
17451673
def detect_console_encoding():
17461674
"""

pandas/core/frame.py

-7
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ class DataFrame(NDFrame):
371371
read_csv / read_table / read_clipboard
372372
"""
373373
_auto_consolidate = True
374-
_verbose_info = True
375374

376375
@property
377376
def _constructor(self):
@@ -554,12 +553,6 @@ def _init_ndarray(self, values, index, columns, dtype=None,
554553

555554
return create_block_manager_from_blocks([values.T], [columns, index])
556555

557-
@property
558-
def _verbose_info(self):
559-
warnings.warn('The _verbose_info property will be removed in version '
560-
'0.13. please use "max_info_rows"', FutureWarning)
561-
return get_option('display.max_info_rows') is None
562-
563556
@property
564557
def axes(self):
565558
return [self.index, self.columns]

pandas/sparse/frame.py

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class SparseDataFrame(DataFrame):
4646
Default fill_value for converting Series to SparseSeries. Will not
4747
override SparseSeries passed in
4848
"""
49-
_verbose_info = False
5049
_constructor_sliced = SparseSeries
5150
_subtyp = 'sparse_frame'
5251

pandas/tests/test_config.py

-2
Original file line numberDiff line numberDiff line change
@@ -437,5 +437,3 @@ def f3(key):
437437
options.c = 1
438438
self.assertEqual(len(holder), 1)
439439

440-
# fmt.reset_printoptions and fmt.set_printoptions were altered
441-
# to use core.config, test_format exercises those paths.

0 commit comments

Comments
 (0)