Python pandas.util.testing.reset_display_options() Examples
The following are 30
code examples of pandas.util.testing.reset_display_options().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.util.testing
, or try the search function
.
Example #1
Source File: test_format.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def test_repr_html(self): self.frame._repr_html_() fmt.set_option('display.max_rows', 1, 'display.max_columns', 1) self.frame._repr_html_() fmt.set_option('display.notebook_repr_html', False) self.frame._repr_html_() tm.reset_display_options() df = DataFrame([[1, 2], [3, 4]]) fmt.set_option('display.show_dimensions', True) assert '2 rows' in df._repr_html_() fmt.set_option('display.show_dimensions', False) assert '2 rows' not in df._repr_html_() tm.reset_display_options()
Example #2
Source File: test_format.py From twitter-stock-recommendation with MIT License | 6 votes |
def test_repr_html(self): self.frame._repr_html_() fmt.set_option('display.max_rows', 1, 'display.max_columns', 1) self.frame._repr_html_() fmt.set_option('display.notebook_repr_html', False) self.frame._repr_html_() tm.reset_display_options() df = DataFrame([[1, 2], [3, 4]]) fmt.set_option('display.show_dimensions', True) assert '2 rows' in df._repr_html_() fmt.set_option('display.show_dimensions', False) assert '2 rows' not in df._repr_html_() tm.reset_display_options()
Example #3
Source File: test_format.py From recruit with Apache License 2.0 | 6 votes |
def test_repr_html(self): self.frame._repr_html_() fmt.set_option('display.max_rows', 1, 'display.max_columns', 1) self.frame._repr_html_() fmt.set_option('display.notebook_repr_html', False) self.frame._repr_html_() tm.reset_display_options() df = DataFrame([[1, 2], [3, 4]]) fmt.set_option('display.show_dimensions', True) assert '2 rows' in df._repr_html_() fmt.set_option('display.show_dimensions', False) assert '2 rows' not in df._repr_html_() tm.reset_display_options()
Example #4
Source File: test_format.py From vnpy_crypto with MIT License | 6 votes |
def test_repr_html(self): self.frame._repr_html_() fmt.set_option('display.max_rows', 1, 'display.max_columns', 1) self.frame._repr_html_() fmt.set_option('display.notebook_repr_html', False) self.frame._repr_html_() tm.reset_display_options() df = DataFrame([[1, 2], [3, 4]]) fmt.set_option('display.show_dimensions', True) assert '2 rows' in df._repr_html_() fmt.set_option('display.show_dimensions', False) assert '2 rows' not in df._repr_html_() tm.reset_display_options()
Example #5
Source File: test_format.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def test_repr_html(self): self.frame._repr_html_() fmt.set_option('display.max_rows', 1, 'display.max_columns', 1) self.frame._repr_html_() fmt.set_option('display.notebook_repr_html', False) self.frame._repr_html_() tm.reset_display_options() df = DataFrame([[1, 2], [3, 4]]) fmt.set_option('display.show_dimensions', True) assert '2 rows' in df._repr_html_() fmt.set_option('display.show_dimensions', False) assert '2 rows' not in df._repr_html_() tm.reset_display_options()
Example #6
Source File: test_eng_formatting.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_eng_float_formatter(self): df = DataFrame({'A': [1.41, 141., 14100, 1410000.]}) fmt.set_eng_float_format() result = df.to_string() expected = (' A\n' '0 1.410E+00\n' '1 141.000E+00\n' '2 14.100E+03\n' '3 1.410E+06') assert result == expected fmt.set_eng_float_format(use_eng_prefix=True) result = df.to_string() expected = (' A\n' '0 1.410\n' '1 141.000\n' '2 14.100k\n' '3 1.410M') assert result == expected fmt.set_eng_float_format(accuracy=0) result = df.to_string() expected = (' A\n' '0 1E+00\n' '1 141E+00\n' '2 14E+03\n' '3 1E+06') assert result == expected tm.reset_display_options()
Example #7
Source File: test_format.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_fake_qtconsole_repr_html(self): def get_ipython(): return {'config': {'KernelApp': {'parent_appname': 'ipython-qtconsole'}}} repstr = self.frame._repr_html_() assert repstr is not None fmt.set_option('display.max_rows', 5, 'display.max_columns', 2) repstr = self.frame._repr_html_() assert 'class' in repstr # info fallback tm.reset_display_options()
Example #8
Source File: test_eng_formatting.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_eng_float_formatter(self): df = DataFrame({'A': [1.41, 141., 14100, 1410000.]}) fmt.set_eng_float_format() result = df.to_string() expected = (' A\n' '0 1.410E+00\n' '1 141.000E+00\n' '2 14.100E+03\n' '3 1.410E+06') assert result == expected fmt.set_eng_float_format(use_eng_prefix=True) result = df.to_string() expected = (' A\n' '0 1.410\n' '1 141.000\n' '2 14.100k\n' '3 1.410M') assert result == expected fmt.set_eng_float_format(accuracy=0) result = df.to_string() expected = (' A\n' '0 1E+00\n' '1 141E+00\n' '2 14E+03\n' '3 1E+06') assert result == expected tm.reset_display_options()
Example #9
Source File: test_eng_formatting.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_nan(self): # Issue #11981 formatter = fmt.EngFormatter(accuracy=1, use_eng_prefix=True) result = formatter(np.nan) assert result == u('NaN') df = pd.DataFrame({'a': [1.5, 10.3, 20.5], 'b': [50.3, 60.67, 70.12], 'c': [100.2, 101.33, 120.33]}) pt = df.pivot_table(values='a', index='b', columns='c') fmt.set_eng_float_format(accuracy=1) result = pt.to_string() assert 'NaN' in result tm.reset_display_options()
Example #10
Source File: test_multi.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_format_sparse_config(self): warn_filters = warnings.filters warnings.filterwarnings('ignore', category=FutureWarning, module=".*format") # GH1538 pd.set_option('display.multi_sparse', False) result = self.index.format() assert result[1] == 'foo two' tm.reset_display_options() warnings.filters = warn_filters
Example #11
Source File: test_repr_info.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_repr_unsortable(self): # columns are not sortable import warnings warn_filters = warnings.filters warnings.filterwarnings('ignore', category=FutureWarning, module=".*format") unsortable = DataFrame({'foo': [1] * 50, datetime.today(): [1] * 50, 'bar': ['bar'] * 50, datetime.today() + timedelta(1): ['bar'] * 50}, index=np.arange(50)) repr(unsortable) fmt.set_option('display.precision', 3, 'display.column_space', 10) repr(self.frame) fmt.set_option('display.max_rows', 10, 'display.max_columns', 2) repr(self.frame) fmt.set_option('display.max_rows', 1000, 'display.max_columns', 1000) repr(self.frame) tm.reset_display_options() warnings.filters = warn_filters
Example #12
Source File: test_format.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_eng_float_formatter(self): self.frame.loc[5] = 0 fmt.set_eng_float_format() repr(self.frame) fmt.set_eng_float_format(use_eng_prefix=True) repr(self.frame) fmt.set_eng_float_format(accuracy=0) repr(self.frame) tm.reset_display_options()
Example #13
Source File: test_format.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_to_string_left_justify_cols(self): tm.reset_display_options() df = DataFrame({'x': [3234, 0.253]}) df_s = df.to_string(justify='left') expected = (' x \n' '0 3234.000\n' '1 0.253') assert df_s == expected
Example #14
Source File: test_format.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_fake_qtconsole_repr_html(self): def get_ipython(): return {'config': {'KernelApp': {'parent_appname': 'ipython-qtconsole'}}} repstr = self.frame._repr_html_() assert repstr is not None fmt.set_option('display.max_rows', 5, 'display.max_columns', 2) repstr = self.frame._repr_html_() assert 'class' in repstr # info fallback tm.reset_display_options()
Example #15
Source File: test_format.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_to_string_format_inf(self): # Issue #24861 tm.reset_display_options() df = DataFrame({ 'A': [-np.inf, np.inf, -1, -2.1234, 3, 4], 'B': [-np.inf, np.inf, 'foo', 'foooo', 'fooooo', 'bar'] }) result = df.to_string() expected = (' A B\n' '0 -inf -inf\n' '1 inf inf\n' '2 -1.0000 foo\n' '3 -2.1234 foooo\n' '4 3.0000 fooooo\n' '5 4.0000 bar') assert result == expected df = DataFrame({ 'A': [-np.inf, np.inf, -1., -2., 3., 4.], 'B': [-np.inf, np.inf, 'foo', 'foooo', 'fooooo', 'bar'] }) result = df.to_string() expected = (' A B\n' '0 -inf -inf\n' '1 inf inf\n' '2 -1.0 foo\n' '3 -2.0 foooo\n' '4 3.0 fooooo\n' '5 4.0 bar') assert result == expected
Example #16
Source File: test_eng_formatting.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_nan(self): # Issue #11981 formatter = fmt.EngFormatter(accuracy=1, use_eng_prefix=True) result = formatter(np.nan) assert result == u('NaN') df = pd.DataFrame({'a': [1.5, 10.3, 20.5], 'b': [50.3, 60.67, 70.12], 'c': [100.2, 101.33, 120.33]}) pt = df.pivot_table(values='a', index='b', columns='c') fmt.set_eng_float_format(accuracy=1) result = pt.to_string() assert 'NaN' in result tm.reset_display_options()
Example #17
Source File: test_format.py From coffeegrindsize with MIT License | 5 votes |
def test_format_sparse_config(idx): warn_filters = warnings.filters warnings.filterwarnings('ignore', category=FutureWarning, module=".*format") # GH1538 pd.set_option('display.multi_sparse', False) result = idx.format() assert result[1] == 'foo two' tm.reset_display_options() warnings.filters = warn_filters
Example #18
Source File: test_multi.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_format_sparse_config(self): warn_filters = warnings.filters warnings.filterwarnings('ignore', category=FutureWarning, module=".*format") # GH1538 pd.set_option('display.multi_sparse', False) result = self.index.format() assert result[1] == 'foo two' tm.reset_display_options() warnings.filters = warn_filters
Example #19
Source File: test_repr_info.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_repr_unsortable(self): # columns are not sortable import warnings warn_filters = warnings.filters warnings.filterwarnings('ignore', category=FutureWarning, module=".*format") unsortable = DataFrame({'foo': [1] * 50, datetime.today(): [1] * 50, 'bar': ['bar'] * 50, datetime.today() + timedelta(1): ['bar'] * 50}, index=np.arange(50)) repr(unsortable) fmt.set_option('display.precision', 3, 'display.column_space', 10) repr(self.frame) fmt.set_option('display.max_rows', 10, 'display.max_columns', 2) repr(self.frame) fmt.set_option('display.max_rows', 1000, 'display.max_columns', 1000) repr(self.frame) tm.reset_display_options() warnings.filters = warn_filters
Example #20
Source File: test_format.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_eng_float_formatter(self): self.frame.loc[5] = 0 fmt.set_eng_float_format() repr(self.frame) fmt.set_eng_float_format(use_eng_prefix=True) repr(self.frame) fmt.set_eng_float_format(accuracy=0) repr(self.frame) tm.reset_display_options()
Example #21
Source File: test_format.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_to_string_left_justify_cols(self): tm.reset_display_options() df = DataFrame({'x': [3234, 0.253]}) df_s = df.to_string(justify='left') expected = (' x \n' '0 3234.000\n' '1 0.253') assert df_s == expected
Example #22
Source File: test_format.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_fake_qtconsole_repr_html(self): def get_ipython(): return {'config': {'KernelApp': {'parent_appname': 'ipython-qtconsole'}}} repstr = self.frame._repr_html_() assert repstr is not None fmt.set_option('display.max_rows', 5, 'display.max_columns', 2) repstr = self.frame._repr_html_() assert 'class' in repstr # info fallback tm.reset_display_options()
Example #23
Source File: test_eng_formatting.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_eng_float_formatter(self): df = DataFrame({'A': [1.41, 141., 14100, 1410000.]}) fmt.set_eng_float_format() result = df.to_string() expected = (' A\n' '0 1.410E+00\n' '1 141.000E+00\n' '2 14.100E+03\n' '3 1.410E+06') assert result == expected fmt.set_eng_float_format(use_eng_prefix=True) result = df.to_string() expected = (' A\n' '0 1.410\n' '1 141.000\n' '2 14.100k\n' '3 1.410M') assert result == expected fmt.set_eng_float_format(accuracy=0) result = df.to_string() expected = (' A\n' '0 1E+00\n' '1 141E+00\n' '2 14E+03\n' '3 1E+06') assert result == expected tm.reset_display_options()
Example #24
Source File: test_eng_formatting.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_nan(self): # Issue #11981 formatter = fmt.EngFormatter(accuracy=1, use_eng_prefix=True) result = formatter(np.nan) assert result == u('NaN') df = pd.DataFrame({'a': [1.5, 10.3, 20.5], 'b': [50.3, 60.67, 70.12], 'c': [100.2, 101.33, 120.33]}) pt = df.pivot_table(values='a', index='b', columns='c') fmt.set_eng_float_format(accuracy=1) result = pt.to_string() assert 'NaN' in result tm.reset_display_options()
Example #25
Source File: test_format.py From vnpy_crypto with MIT License | 5 votes |
def test_eng_float_formatter(self): self.frame.loc[5] = 0 fmt.set_eng_float_format() repr(self.frame) fmt.set_eng_float_format(use_eng_prefix=True) repr(self.frame) fmt.set_eng_float_format(accuracy=0) repr(self.frame) tm.reset_display_options()
Example #26
Source File: test_repr_info.py From recruit with Apache License 2.0 | 5 votes |
def test_repr_unsortable(self): # columns are not sortable import warnings warn_filters = warnings.filters warnings.filterwarnings('ignore', category=FutureWarning, module=".*format") unsortable = DataFrame({'foo': [1] * 50, datetime.today(): [1] * 50, 'bar': ['bar'] * 50, datetime.today() + timedelta(1): ['bar'] * 50}, index=np.arange(50)) repr(unsortable) fmt.set_option('display.precision', 3, 'display.column_space', 10) repr(self.frame) fmt.set_option('display.max_rows', 10, 'display.max_columns', 2) repr(self.frame) fmt.set_option('display.max_rows', 1000, 'display.max_columns', 1000) repr(self.frame) tm.reset_display_options() warnings.filters = warn_filters
Example #27
Source File: test_format.py From recruit with Apache License 2.0 | 5 votes |
def test_eng_float_formatter(self): self.frame.loc[5] = 0 fmt.set_eng_float_format() repr(self.frame) fmt.set_eng_float_format(use_eng_prefix=True) repr(self.frame) fmt.set_eng_float_format(accuracy=0) repr(self.frame) tm.reset_display_options()
Example #28
Source File: test_format.py From recruit with Apache License 2.0 | 5 votes |
def test_to_string_left_justify_cols(self): tm.reset_display_options() df = DataFrame({'x': [3234, 0.253]}) df_s = df.to_string(justify='left') expected = (' x \n' '0 3234.000\n' '1 0.253') assert df_s == expected
Example #29
Source File: test_format.py From recruit with Apache License 2.0 | 5 votes |
def test_to_string_format_inf(self): # Issue #24861 tm.reset_display_options() df = DataFrame({ 'A': [-np.inf, np.inf, -1, -2.1234, 3, 4], 'B': [-np.inf, np.inf, 'foo', 'foooo', 'fooooo', 'bar'] }) result = df.to_string() expected = (' A B\n' '0 -inf -inf\n' '1 inf inf\n' '2 -1.0000 foo\n' '3 -2.1234 foooo\n' '4 3.0000 fooooo\n' '5 4.0000 bar') assert result == expected df = DataFrame({ 'A': [-np.inf, np.inf, -1., -2., 3., 4.], 'B': [-np.inf, np.inf, 'foo', 'foooo', 'fooooo', 'bar'] }) result = df.to_string() expected = (' A B\n' '0 -inf -inf\n' '1 inf inf\n' '2 -1.0 foo\n' '3 -2.0 foooo\n' '4 3.0 fooooo\n' '5 4.0 bar') assert result == expected
Example #30
Source File: test_format.py From recruit with Apache License 2.0 | 5 votes |
def test_fake_qtconsole_repr_html(self): def get_ipython(): return {'config': {'KernelApp': {'parent_appname': 'ipython-qtconsole'}}} repstr = self.frame._repr_html_() assert repstr is not None fmt.set_option('display.max_rows', 5, 'display.max_columns', 2) repstr = self.frame._repr_html_() assert 'class' in repstr # info fallback tm.reset_display_options()