Skip to content

API: Remove set_printoptions/reset_printoptions (:issue:3046) #5001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ Methods like ``replace`` and ``findall`` take regular expressions, too:
s3.str.replace('^.a|dog', 'XX-XX ', case=False)

The method ``match`` returns the groups in a regular expression in one tuple.
Starting in pandas version 0.13, the method ``extract`` is available to
Starting in pandas version 0.13, the method ``extract`` is available to
accomplish this more conveniently.

Extracting a regular expression with one group returns a Series of strings.
Expand All @@ -992,16 +992,16 @@ Extracting a regular expression with one group returns a Series of strings.

Series(['a1', 'b2', 'c3']).str.extract('[ab](\d)')

Elements that do not match return ``NaN``. Extracting a regular expression
Elements that do not match return ``NaN``. Extracting a regular expression
with more than one group returns a DataFrame with one column per group.

.. ipython:: python

Series(['a1', 'b2', 'c3']).str.extract('([ab])(\d)')

Elements that do not match return a row of ``NaN``s.
Thus, a Series of messy strings can be "converted" into a
like-indexed Series or DataFrame of cleaned-up or more useful strings,
Elements that do not match return a row of ``NaN``s.
Thus, a Series of messy strings can be "converted" into a
like-indexed Series or DataFrame of cleaned-up or more useful strings,
without necessitating ``get()`` to access tuples or ``re.match`` objects.

Named groups like
Expand Down Expand Up @@ -1411,11 +1411,6 @@ Console Output Formatting

.. _basics.console_output:

**Note:** ``set_printoptions``/ ``reset_printoptions`` are now deprecated (but functioning),
and both, as well as ``set_eng_float_format``, use the options API behind the scenes.
The corresponding options now live under "print.XYZ", and you can set them directly with
``get/set_option``.

Use the ``set_eng_float_format`` function in the ``pandas.core.common`` module
to alter the floating-point formatting of pandas objects to produce a particular
format.
Expand Down
2 changes: 2 additions & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ API Changes
on indexes on non ``Float64Index`` will raise a ``TypeError``, e.g. ``Series(range(5))[3.5:4.5]`` (:issue:`263`)
- Make Categorical repr nicer (:issue:`4368`)
- Remove deprecated ``Factor`` (:issue:`3650`)
- Remove deprecated ``set_printoptions/reset_printoptions`` (:issue:``3046``)
- Remove deprecated ``_verbose_info`` (:issue:`3215`)

Internal Refactoring
~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions doc/source/v0.13.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ API changes
df1 and df2
s1 and s2

- Remove deprecated ``Factor`` (:issue:`3650`)
- Remove deprecated ``set_printoptions/reset_printoptions`` (:issue:``3046``)
- Remove deprecated ``_verbose_info`` (:issue:`3215`)

Indexing API Changes
~~~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 0 additions & 1 deletion pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# XXX: HACK for NumPy 1.5.1 to suppress warnings
try:
np.seterr(all='ignore')
# np.set_printoptions(suppress=True)
except Exception: # pragma: no cover
pass

Expand Down
3 changes: 1 addition & 2 deletions pandas/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from pandas.core.algorithms import factorize, match, unique, value_counts
from pandas.core.common import isnull, notnull
from pandas.core.categorical import Categorical
from pandas.core.format import (set_printoptions, reset_printoptions,
set_eng_float_format)
from pandas.core.format import set_eng_float_format
from pandas.core.index import Index, Int64Index, Float64Index, MultiIndex

from pandas.core.series import Series, TimeSeries
Expand Down
74 changes: 1 addition & 73 deletions pandas/core/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
multiindex key at each row, default True
justify : {'left', 'right'}, default None
Left or right-justify the column labels. If None uses the option from
the print configuration (controlled by set_printoptions), 'right' out
the print configuration (controlled by set_option), 'right' out
of the box.
index_names : bool, optional
Prints the names of the indexes, default True
Expand Down Expand Up @@ -1669,78 +1669,6 @@ def _has_names(index):
#------------------------------------------------------------------------------
# Global formatting options


def set_printoptions(precision=None, column_space=None, max_rows=None,
max_columns=None, colheader_justify=None,
max_colwidth=None, notebook_repr_html=None,
date_dayfirst=None, date_yearfirst=None,
pprint_nest_depth=None, multi_sparse=None, encoding=None):
"""
Alter default behavior of DataFrame.toString

precision : int
Floating point output precision (number of significant digits). This is
only a suggestion
column_space : int
Default space for DataFrame columns, defaults to 12
max_rows : int
max_columns : int
max_rows and max_columns are used in __repr__() methods to decide if
to_string() or info() is used to render an object to a string.
Either one, or both can be set to 0 (experimental). Pandas will figure
out how big the terminal is and will not display more rows or/and
columns that can fit on it.
colheader_justify
notebook_repr_html : boolean
When True (default), IPython notebook will use html representation for
pandas objects (if it is available).
date_dayfirst : boolean
When True, prints and parses dates with the day first, eg 20/01/2005
date_yearfirst : boolean
When True, prints and parses dates with the year first, eg 2005/01/20
pprint_nest_depth : int
Defaults to 3.
Controls the number of nested levels to process when pretty-printing
nested sequences.
multi_sparse : boolean
Default True, "sparsify" MultiIndex display (don't display repeated
elements in outer levels within groups)
"""
import warnings
warnings.warn("set_printoptions is deprecated, use set_option instead",
FutureWarning)
if precision is not None:
set_option("display.precision", precision)
if column_space is not None:
set_option("display.column_space", column_space)
if max_rows is not None:
set_option("display.max_rows", max_rows)
if max_colwidth is not None:
set_option("display.max_colwidth", max_colwidth)
if max_columns is not None:
set_option("display.max_columns", max_columns)
if colheader_justify is not None:
set_option("display.colheader_justify", colheader_justify)
if notebook_repr_html is not None:
set_option("display.notebook_repr_html", notebook_repr_html)
if date_dayfirst is not None:
set_option("display.date_dayfirst", date_dayfirst)
if date_yearfirst is not None:
set_option("display.date_yearfirst", date_yearfirst)
if pprint_nest_depth is not None:
set_option("display.pprint_nest_depth", pprint_nest_depth)
if multi_sparse is not None:
set_option("display.multi_sparse", multi_sparse)
if encoding is not None:
set_option("display.encoding", encoding)


def reset_printoptions():
import warnings
warnings.warn("reset_printoptions is deprecated, use reset_option instead",
FutureWarning)
reset_option("^display\.")

_initial_defencoding = None
def detect_console_encoding():
"""
Expand Down
7 changes: 0 additions & 7 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ class DataFrame(NDFrame):
read_csv / read_table / read_clipboard
"""
_auto_consolidate = True
_verbose_info = True

@property
def _constructor(self):
Expand Down Expand Up @@ -554,12 +553,6 @@ def _init_ndarray(self, values, index, columns, dtype=None,

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

@property
def _verbose_info(self):
warnings.warn('The _verbose_info property will be removed in version '
'0.13. please use "max_info_rows"', FutureWarning)
return get_option('display.max_info_rows') is None

@property
def axes(self):
return [self.index, self.columns]
Expand Down
1 change: 0 additions & 1 deletion pandas/sparse/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class SparseDataFrame(DataFrame):
Default fill_value for converting Series to SparseSeries. Will not
override SparseSeries passed in
"""
_verbose_info = False
_constructor_sliced = SparseSeries
_subtyp = 'sparse_frame'

Expand Down
2 changes: 0 additions & 2 deletions pandas/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,5 +437,3 @@ def f3(key):
options.c = 1
self.assertEqual(len(holder), 1)

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