From 5674f9ba9777b54c00c6ab4519d22893a11ed426 Mon Sep 17 00:00:00 2001 From: aqurilla Date: Tue, 18 Dec 2018 11:23:47 -0500 Subject: [PATCH 1/3] Fix pandas #24235 --- doc/source/whatsnew/v0.17.0.rst | 53 ++++++++++++++++----------------- doc/source/whatsnew/v0.17.1.rst | 3 +- setup.cfg | 2 -- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/doc/source/whatsnew/v0.17.0.rst b/doc/source/whatsnew/v0.17.0.rst index 38d2ec2d8d1bf..d49e3e41536d6 100644 --- a/doc/source/whatsnew/v0.17.0.rst +++ b/doc/source/whatsnew/v0.17.0.rst @@ -8,7 +8,6 @@ v0.17.0 (October 9, 2015) .. ipython:: python :suppress: - from pandas import * # noqa F401, F403 This is a major release from 0.16.2 and includes a small number of API changes, several new features, @@ -85,9 +84,9 @@ The new implementation allows for having a single-timezone across all rows, with .. ipython:: python - df = DataFrame({'A' : date_range('20130101',periods=3), - 'B' : date_range('20130101',periods=3,tz='US/Eastern'), - 'C' : date_range('20130101',periods=3,tz='CET')}) + df = DataFrame({'A': date_range('20130101', periods=3), + 'B': date_range('20130101', periods=3, tz='US/Eastern'), + 'C': date_range('20130101', periods=3, tz='CET')}) df df.dtypes @@ -112,20 +111,20 @@ This uses a new-dtype representation as well, that is very similar in look-and-f .. code-block:: ipython - In [1]: pd.date_range('20130101',periods=3,tz='US/Eastern') + In [1]: pd.date_range('20130101', periods=3, tz='US/Eastern') Out[1]: DatetimeIndex(['2013-01-01 00:00:00-05:00', '2013-01-02 00:00:00-05:00', '2013-01-03 00:00:00-05:00'], dtype='datetime64[ns]', freq='D', tz='US/Eastern') - In [2]: pd.date_range('20130101',periods=3,tz='US/Eastern').dtype + In [2]: pd.date_range('20130101', periods=3, tz='US/Eastern').dtype Out[2]: dtype('` for more details. @@ -297,16 +296,16 @@ See the :ref:`documentation ` for more details. .. ipython:: python - df = pd.DataFrame([[1,2,3,4], [5,6,7,8]], - columns = pd.MultiIndex.from_product([['foo','bar'],['a','b']], - names = ['col1', 'col2']), - index = pd.MultiIndex.from_product([['j'], ['l', 'k']], - names = ['i1', 'i2'])) + df = pd.DataFrame([[1, 2, 3, 4], [5, 6, 7, 8]], + columns=pd.MultiIndex.from_product( + [['foo', 'bar'], ['a', 'b']], names=['col1', 'col2']), + index=pd.MultiIndex.from_product([['j'], ['l', 'k']], + names=['i1', 'i2'])) df df.to_excel('test.xlsx') - df = pd.read_excel('test.xlsx', header=[0,1], index_col=[0,1]) + df = pd.read_excel('test.xlsx', header=[0, 1], index_col=[0, 1]) df .. ipython:: python @@ -412,15 +411,15 @@ Other enhancements .. ipython:: python - foo = pd.Series([1,2], name='foo') - bar = pd.Series([1,2]) - baz = pd.Series([4,5]) + foo = pd.Series([1, 2], name='foo') + bar = pd.Series([1, 2]) + baz = pd.Series([4, 5]) Previous Behavior: .. code-block:: ipython - In [1] pd.concat([foo, bar, baz], 1) + In [1]: pd.concat([foo, bar, baz], 1) Out[1]: 0 1 2 0 1 1 4 @@ -748,14 +747,14 @@ Previous Behavior: .. code-block:: ipython - In [5]: s==None + In [5]: s == None TypeError: Could not compare type with Series New Behavior: .. ipython:: python - s==None + s == None Usually you simply want to know which values are null. @@ -784,8 +783,8 @@ Previous Behavior: .. ipython:: python - df_with_missing = pd.DataFrame({'col1':[0, np.nan, 2], - 'col2':[1, np.nan, np.nan]}) + df_with_missing = pd.DataFrame({'col1': [0, np.nan, 2], + 'col2': [1, np.nan, np.nan]}) df_with_missing @@ -817,8 +816,8 @@ New Behavior: df_with_missing.to_hdf('file.h5', 'df_with_missing', - format='table', - mode='w') + format='table', + mode='w') pd.read_hdf('file.h5', 'df_with_missing') diff --git a/doc/source/whatsnew/v0.17.1.rst b/doc/source/whatsnew/v0.17.1.rst index 77dda4cfb1f44..b06dbbf453d88 100644 --- a/doc/source/whatsnew/v0.17.1.rst +++ b/doc/source/whatsnew/v0.17.1.rst @@ -8,7 +8,6 @@ v0.17.1 (November 21, 2015) .. ipython:: python :suppress: - from pandas import * # noqa F401, F403 .. note:: @@ -85,7 +84,7 @@ Enhancements .. ipython:: python - df = DataFrame({'A' : ['foo']*1000}) + df = DataFrame({'A': ['foo'] * 1000}) df['B'] = df['A'].astype('category') # shows the '+' as we have object dtypes diff --git a/setup.cfg b/setup.cfg index 1ce4e5816f7ca..14209629e8e1d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -53,8 +53,6 @@ exclude = doc/source/whatsnew/v0.16.0.rst doc/source/whatsnew/v0.16.1.rst doc/source/whatsnew/v0.16.2.rst - doc/source/whatsnew/v0.17.0.rst - doc/source/whatsnew/v0.17.1.rst doc/source/basics.rst doc/source/contributing_docstring.rst doc/source/enhancingperf.rst From 245d21eb71d88692a4a3db992c718bba36dd9828 Mon Sep 17 00:00:00 2001 From: aqurilla Date: Mon, 31 Dec 2018 23:45:15 -0500 Subject: [PATCH 2/3] Fix flake8 issues #24235 --- doc/source/whatsnew/v0.17.0.rst | 8 ++++---- doc/source/whatsnew/v0.17.1.rst | 2 +- setup.cfg | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/doc/source/whatsnew/v0.17.0.rst b/doc/source/whatsnew/v0.17.0.rst index d49e3e41536d6..8a758fbdb4f0d 100644 --- a/doc/source/whatsnew/v0.17.0.rst +++ b/doc/source/whatsnew/v0.17.0.rst @@ -174,7 +174,7 @@ As a result of this change, these methods are now all discoverable via tab-compl .. ipython:: :verbatim: - In [15]: df.plot. + In [15]: df.plot. # noqa: E225, E999 df.plot.area df.plot.barh df.plot.density df.plot.hist df.plot.line df.plot.scatter df.plot.bar df.plot.box df.plot.hexbin df.plot.kde df.plot.pie @@ -747,14 +747,14 @@ Previous Behavior: .. code-block:: ipython - In [5]: s == None + In [5]: s == None # noqa: E711 TypeError: Could not compare type with Series New Behavior: .. ipython:: python - s == None + s == None # noqa: E711 Usually you simply want to know which values are null. @@ -769,7 +769,7 @@ Usually you simply want to know which values are null. .. ipython:: python - None == None + None == None # noqa: E711 np.nan == np.nan .. _whatsnew_0170.api_breaking.hdf_dropna: diff --git a/doc/source/whatsnew/v0.17.1.rst b/doc/source/whatsnew/v0.17.1.rst index b06dbbf453d88..ddde96c9f598d 100644 --- a/doc/source/whatsnew/v0.17.1.rst +++ b/doc/source/whatsnew/v0.17.1.rst @@ -84,7 +84,7 @@ Enhancements .. ipython:: python - df = DataFrame({'A': ['foo'] * 1000}) + df = DataFrame({'A': ['foo'] * 1000}) # noqa: F821 df['B'] = df['A'].astype('category') # shows the '+' as we have object dtypes diff --git a/setup.cfg b/setup.cfg index eca08e6f166f3..b3690290cc9bd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,8 +48,6 @@ exclude = doc/source/whatsnew/v0.15.0.rst doc/source/whatsnew/v0.15.1.rst doc/source/whatsnew/v0.15.2.rst - doc/source/whatsnew/v0.17.0.rst - doc/source/whatsnew/v0.17.1.rst doc/source/basics.rst doc/source/contributing_docstring.rst doc/source/enhancingperf.rst From 29c9163c637b45fdc5475bdbdb2e6488cdf8f06a Mon Sep 17 00:00:00 2001 From: aqurilla Date: Tue, 1 Jan 2019 20:28:57 -0500 Subject: [PATCH 3/3] Updated setup.cfg noqa exception E711 --- doc/source/whatsnew/v0.17.0.rst | 6 +++--- setup.cfg | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v0.17.0.rst b/doc/source/whatsnew/v0.17.0.rst index 8a758fbdb4f0d..4884d99d8fc91 100644 --- a/doc/source/whatsnew/v0.17.0.rst +++ b/doc/source/whatsnew/v0.17.0.rst @@ -747,14 +747,14 @@ Previous Behavior: .. code-block:: ipython - In [5]: s == None # noqa: E711 + In [5]: s == None TypeError: Could not compare type with Series New Behavior: .. ipython:: python - s == None # noqa: E711 + s == None Usually you simply want to know which values are null. @@ -769,7 +769,7 @@ Usually you simply want to know which values are null. .. ipython:: python - None == None # noqa: E711 + None == None np.nan == np.nan .. _whatsnew_0170.api_breaking.hdf_dropna: diff --git a/setup.cfg b/setup.cfg index b3690290cc9bd..3a5581bac04b2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,6 +43,7 @@ ignore = E402, # module level import not at top of file E305, # expected 2 blank lines after class or function definition, found 0 # We use semicolon at the end to avoid displaying plot objects E703, # statement ends with a semicolon + E711, # comparison to none should be 'if cond is none:' exclude = doc/source/whatsnew/v0.15.0.rst