Skip to content

Fixed PEP8 errors in doc/source/whatsnew/v0.15.* #24328

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

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
83 changes: 39 additions & 44 deletions doc/source/whatsnew/v0.15.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ v0.15.0 (October 18, 2014)

{{ header }}

.. ipython:: python
:suppress:

from pandas import * # noqa F401, F403


This is a major release from 0.14.1 and includes a small number of API changes, several new features,
enhancements, and performance improvements along with a large number of bug fixes. We recommend that all
users upgrade to this version.
Expand Down Expand Up @@ -77,7 +71,7 @@ For full docs, see the :ref:`categorical introduction <categorical>` and the
.. ipython:: python
:okwarning:

df = DataFrame({"id":[1,2,3,4,5,6], "raw_grade":['a', 'b', 'b', 'a', 'a', 'e']})
df = DataFrame({"id": [1, 2, 3, 4, 5, 6], "raw_grade": ['a', 'b', 'b', 'a', 'a', 'e']})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the line too long you mention in the description? You can fix it by simply:

df = DataFrame({"id": [1, 2, 3, 4, 5, 6],
                "raw_grade": ['a', 'b', 'b', 'a', 'a', 'e']})

Or something similar, if you need to do it somewhere else too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this,but it led to more pep8 errors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the block is a code-block, you may need to add ... to the beginning of the continuation file. If you can't get it fixed yourself, leave it the way you think it's correct in the PR, so we can review it, and also see the errors in the CI.


df["grade"] = df["raw_grade"].astype("category")
df["grade"]
Expand Down Expand Up @@ -181,22 +175,22 @@ Construct a ``TimedeltaIndex``

.. ipython:: python

TimedeltaIndex(['1 days','1 days, 00:00:05',
np.timedelta64(2,'D'),timedelta(days=2,seconds=2)])
TimedeltaIndex(['1 days', '1 days, 00:00:05',
np.timedelta64(2, 'D'), timedelta(days=2, seconds=2)])

Constructing a ``TimedeltaIndex`` with a regular range

.. ipython:: python

timedelta_range('1 days',periods=5,freq='D')
timedelta_range(start='1 days',end='2 days',freq='30T')
timedelta_range('1 days', periods=5, freq='D')
timedelta_range(start='1 days', end='2 days', freq='30T')

You can now use a ``TimedeltaIndex`` as the index of a pandas object

.. ipython:: python

s = Series(np.arange(5),
index=timedelta_range('1 days',periods=5,freq='s'))
index=timedelta_range('1 days', periods=5, freq='s'))
s

You can select with partial string selections
Expand All @@ -210,9 +204,9 @@ Finally, the combination of ``TimedeltaIndex`` with ``DatetimeIndex`` allow cert

.. ipython:: python

tdi = TimedeltaIndex(['1 days',pd.NaT,'2 days'])
tdi = TimedeltaIndex(['1 days', pd.NaT, '2 days'])
tdi.tolist()
dti = date_range('20130101',periods=3)
dti = date_range('20130101', periods=3)
dti.tolist()

(dti + tdi).tolist()
Expand All @@ -235,7 +229,7 @@ A new display option ``display.memory_usage`` (see :ref:`options`) sets the defa
dtypes = ['int64', 'float64', 'datetime64[ns]', 'timedelta64[ns]',
'complex128', 'object', 'bool']
n = 5000
data = dict([ (t, np.random.randint(100, size=n).astype(t))
data = dict([(t, np.random.randint(100, size=n).astype(t))
for t in dtypes])
df = DataFrame(data)
df['categorical'] = df['object'].astype('category')
Expand All @@ -260,7 +254,7 @@ This will return a Series, indexed like the existing Series. See the :ref:`docs
.. ipython:: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert this change? (there needs to be a blank line between the last sentence and .. ipython::)


# datetime
s = Series(date_range('20130101 09:10:12',periods=4))
s = Series(date_range('20130101 09:10:12', periods=4))
s
s.dt.hour
s.dt.second
Expand Down Expand Up @@ -292,15 +286,15 @@ The ``.dt`` accessor works for period and timedelta dtypes.
.. ipython:: python

# period
s = Series(period_range('20130101',periods=4,freq='D'))
s = Series(period_range('20130101', periods=4, freq='D'))
s
s.dt.year
s.dt.day

.. ipython:: python

# timedelta
s = Series(timedelta_range('1 day 00:00:05',periods=4,freq='s'))
s = Series(timedelta_range('1 day 00:00:05', periods=4, freq='s'))
s
s.dt.days
s.dt.seconds
Expand Down Expand Up @@ -667,7 +661,7 @@ Other notable API changes:

.. ipython:: python

df = DataFrame([['a'],['b']],index=[1,2])
df = DataFrame([['a'], ['b']], index=[1, 2])
df

In prior versions there was a difference in these two constructs:
Expand All @@ -686,13 +680,13 @@ Other notable API changes:

.. code-block:: ipython

In [3]: df.loc[[1,3]]
In [3]: df.loc[[1, 3]]
Out[3]:
0
1 a
3 NaN

In [4]: df.loc[[1,3],:]
In [4]: df.loc[[1, 3], :]
Out[4]:
0
1 a
Expand All @@ -702,10 +696,10 @@ Other notable API changes:

.. ipython:: python

p = Panel(np.arange(2*3*4).reshape(2,3,4),
items=['ItemA','ItemB'],
major_axis=[1,2,3],
minor_axis=['A','B','C','D'])
p = Panel(np.arange(2 * 3 * 4).reshape(2, 3, 4),
items=['ItemA', 'ItemB'],
major_axis=[1, 2, 3],
minor_axis=['A', 'B', 'C', 'D'])
p

The following would raise ``KeyError`` prior to 0.15.0:
Expand All @@ -724,15 +718,15 @@ Other notable API changes:
.. ipython:: python
:okexcept:

s = Series(np.arange(3,dtype='int64'),
index=MultiIndex.from_product([['A'],['foo','bar','baz']],
names=['one','two'])
).sort_index()
s = Series(np.arange(3, dtype='int64'),
index=MultiIndex.from_product([['A'], ['foo', 'bar', 'baz']],
names=['one', 'two'])
).sort_index()
s
try:
s.loc[['D']]
s.loc[['D']]
except KeyError as e:
print("KeyError: " + str(e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add back this print statement?

print("KeyError: " + str(e))

- Assigning values to ``None`` now considers the dtype when choosing an 'empty' value (:issue:`7941`).

Expand Down Expand Up @@ -815,9 +809,9 @@ Other notable API changes:

.. ipython:: python

i = date_range('1/1/2011', periods=3, freq='10s', tz = 'US/Eastern')
i = date_range('1/1/2011', periods=3, freq='10s', tz='US/Eastern')
i
df = DataFrame( {'a' : i } )
df = DataFrame({'a': i})
df
df.dtypes

Expand All @@ -836,7 +830,7 @@ Other notable API changes:

.. code-block:: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indentation is wrong, should be at the top level. And this should be a .. code-block:: ipython (ipython instead of python.

See similar examples for the exact format.


In [1]: df = DataFrame(np.arange(0,9), columns=['count'])
In [1]: df = DataFrame(np.arange(0, 9), columns=['count'])

In [2]: df['group'] = 'b'

Expand All @@ -854,8 +848,8 @@ Other notable API changes:

.. ipython:: python

df = DataFrame([[True, 1],[False, 2]],
columns=["female","fitness"])
df = DataFrame([[True, 1], [False, 2]],
columns=["female", "fitness"])
df
df.dtypes

Expand Down Expand Up @@ -915,18 +909,18 @@ Deprecations
.. code-block:: python

# +
Index(['a','b','c']) + Index(['b','c','d'])
Index(['a', 'b', 'c']) + Index(['b', 'c', 'd'])

# should be replaced by
Index(['a','b','c']).union(Index(['b','c','d']))
Index(['a', 'b', 'c']).union(Index(['b', 'c', 'd']))

.. code-block:: python

# -
Index(['a','b','c']) - Index(['b','c','d'])
Index(['a', 'b', 'c']) - Index(['b', 'c', 'd'])

# should be replaced by
Index(['a','b','c']).difference(Index(['b','c','d']))
Index(['a', 'b', 'c']).difference(Index(['b', 'c', 'd']))

- The ``infer_types`` argument to :func:`~pandas.read_html` now has no
effect and is deprecated (:issue:`7762`, :issue:`7032`).
Expand Down Expand Up @@ -1050,11 +1044,12 @@ Other:

.. ipython:: python

idx = MultiIndex.from_product([['a'], range(3), list("pqr")], names=['foo', 'bar', 'baz'])
idx = MultiIndex.from_product(
[['a'], range(3), list("pqr")], names=['foo', 'bar', 'baz'])
idx.set_names('qux', level=0)
idx.set_names(['qux','corge'], level=[0,1])
idx.set_levels(['a','b','c'], level='bar')
idx.set_levels([['a','b','c'],[1,2,3]], level=[1,2])
idx.set_names(['qux', 'corge'], level=[0, 1])
idx.set_levels(['a', 'b', 'c'], level='bar')
idx.set_levels([['a', 'b', 'c'], [1, 2, 3]], level=[1, 2])

- ``Index.isin`` now supports a ``level`` argument to specify which index level
to use for membership tests (:issue:`7892`, :issue:`7890`)
Expand Down
16 changes: 5 additions & 11 deletions doc/source/whatsnew/v0.15.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ v0.15.1 (November 9, 2014)

{{ header }}

.. ipython:: python
:suppress:

from pandas import * # noqa F401, F403


This is a minor bug-fix release from 0.15.0 and includes a small number of API changes, several new features,
enhancements, and performance improvements along with a large number of bug fixes. We recommend that all
users upgrade to this version.
Expand All @@ -28,7 +22,7 @@ API changes

.. ipython:: python

s = Series(date_range('20130101',periods=5,freq='D'))
s = Series(date_range('20130101', periods=5, freq='D'))
s.iloc[2] = np.nan
s

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you try to redefine df and ts before line 64 (can't comment there, as it's not edited in the PR)

I think they should be accessible from the previous block. You can also use # noqa F821 in the failing line, to stop the error from being raised.

Expand Down Expand Up @@ -156,9 +150,9 @@ API changes

In [17]: from pandas.io.data import Options

In [18]: aapl = Options('aapl','yahoo')
In [18]: aapl = Options('aapl', 'yahoo')

In [19]: aapl.get_call_data().iloc[0:5,0:1]
In [19]: aapl.get_call_data().iloc[0:5, 0:1]
Out[19]:
Last
Strike Expiry Type Symbol
Expand All @@ -183,7 +177,7 @@ API changes
datetime.date(2016, 1, 15),
datetime.date(2017, 1, 20)]

In [21]: aapl.get_near_stock_price(expiry=aapl.expiry_dates[0:3]).iloc[0:5,0:1]
In [21]: aapl.get_near_stock_price(expiry=aapl.expiry_dates[0:3]).iloc[0:5, 0:1]
Out[21]:
Last
Strike Expiry Type Symbol
Expand Down Expand Up @@ -233,7 +227,7 @@ Enhancements

.. ipython:: python

dfi = DataFrame(1,index=pd.MultiIndex.from_product([['a'],range(1000)]),columns=['A'])
dfi = DataFrame(1, index=pd.MultiIndex.from_product([['a'], range(1000)]), columns=['A'])

previous behavior:

Expand Down
8 changes: 1 addition & 7 deletions doc/source/whatsnew/v0.15.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ v0.15.2 (December 12, 2014)

{{ header }}

.. ipython:: python
:suppress:

from pandas import * # noqa F401, F403


This is a minor release from 0.15.1 and includes a large number of bug fixes
along with several new features, enhancements, and performance improvements.
A small number of API changes were necessary to fix existing bugs.
Expand Down Expand Up @@ -79,7 +73,7 @@ API changes

.. ipython:: python

data = pd.DataFrame({'x':[1, 2, 3]})
data = pd.DataFrame({'x': [1, 2, 3]})
data.y = 2
data['y'] = [2, 4, 6]
data
Expand Down
Binary file added doc/test.parquet
Binary file not shown.
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ ignore = E402, # module level import not at top of file
exclude =
doc/source/whatsnew/v0.13.0.rst
doc/source/whatsnew/v0.13.1.rst
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.14.0.rst
doc/source/whatsnew/v0.14.1.rst
doc/source/whatsnew/v0.16.0.rst
doc/source/whatsnew/v0.16.1.rst
doc/source/whatsnew/v0.16.2.rst
Expand Down