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

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

wants to merge 18 commits into from

Conversation

joybh98
Copy link
Contributor

@joybh98 joybh98 commented Dec 18, 2018

@codecov
Copy link

codecov bot commented Dec 18, 2018

Codecov Report

Merging #24328 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #24328   +/-   ##
=======================================
  Coverage   92.28%   92.28%           
=======================================
  Files         162      162           
  Lines       51831    51831           
=======================================
  Hits        47830    47830           
  Misses       4001     4001
Flag Coverage Δ
#multiple 90.68% <ø> (ø) ⬆️
#single 43% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 216986d...6790593. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 18, 2018

Codecov Report

Merging #24328 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24328      +/-   ##
==========================================
- Coverage   92.38%   92.37%   -0.01%     
==========================================
  Files         166      166              
  Lines       52490    52471      -19     
==========================================
- Hits        48493    48471      -22     
- Misses       3997     4000       +3
Flag Coverage Δ
#multiple 90.8% <ø> (-0.02%) ⬇️
#single 43.05% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/internals/blocks.py 94.21% <0%> (-0.33%) ⬇️
pandas/core/indexes/datetimelike.py 98.53% <0%> (-0.31%) ⬇️
pandas/core/nanops.py 94.36% <0%> (-0.19%) ⬇️
pandas/core/arrays/categorical.py 95.41% <0%> (-0.06%) ⬇️
pandas/core/indexes/category.py 98.61% <0%> (-0.04%) ⬇️
pandas/core/internals/__init__.py 100% <0%> (ø) ⬆️
pandas/core/series.py 93.56% <0%> (+0.02%) ⬆️
pandas/core/internals/managers.py 96.05% <0%> (+0.08%) ⬆️
pandas/util/testing.py 88.09% <0%> (+0.09%) ⬆️
pandas/core/arrays/timedeltas.py 88.18% <0%> (+0.19%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9175387...1b08068. Read the comment docs.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the PR. Some comments in the code. Besides those:

  • Remove the test.parquet file you committed
  • Edit setup.cfg and remove the files you fixed from the list of exclude files of flake8-rst, so they start being validated
  • Edit the PR description and replace the #xxxxx by the issue you're closing

@@ -7,10 +7,11 @@ v0.15.0 (October 18, 2014)

.. ipython:: python
:suppress:

from pandas import * # noqa F401, F403
Copy link
Member

Choose a reason for hiding this comment

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

we want to delete this whole block, that's one of the main points of the issue (see the description)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to be sure, you want me to remove the whole ipython block, am i right?

Copy link
Member

Choose a reason for hiding this comment

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

from pandas import * # noqa F401, F403



Copy link
Member

Choose a reason for hiding this comment

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

this blank line is unnecessary, and it should break the validation

@joybh98
Copy link
Contributor Author

joybh98 commented Dec 18, 2018

Okay,will fix all the problems.

@jreback
Copy link
Contributor

jreback commented Dec 18, 2018

pls merge master as well

@datapythonista
Copy link
Member

@joybhallaa can you update in the description the issue you're closing

@datapythonista
Copy link
Member

And when you fixed the conflict, looks like the 0.14.* files have been added back to the list of exclusions (check the diff in the PR). Can you remove them again.

Don't worry much, all these things usually happen to every first contributor. But we need everything in place to be able to merge this. :)

@@ -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.

@joybh98
Copy link
Contributor Author

joybh98 commented Dec 20, 2018

@datapythonista , no need to comment, i know there are some errors left, but my machine is giving me some problems and I'll try to push the changes ASAP and will keep pushing them till all tests are passed.

@joybh98
Copy link
Contributor Author

joybh98 commented Dec 21, 2018

@datapythonista , can't get rid of the remaining errors.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Besides the comments, can you restore the style.ipynb you deleted please

@@ -836,7 +833,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.

@@ -28,7 +22,7 @@ API changes

.. ipython:: python

s = Series(date_range('20130101',periods=5,freq='D'))
s = pd.Series(pd.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.

@datapythonista
Copy link
Member

You've got whitespaces in doc/source/whatsnew/v0.15.0.rst line 729, if you can remove them (and it can be a good idea to activate validation of pep8 errors in general in your editor, to avoid those).

Also, if you can merge master.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

couple of comments, besides the problem with the whitespaces already mentioned

@joybhallaa do you have time to finish this?


Previously, assigning to ``None`` in numeric containers changed the
dtype to object (or errored, depending on the call). It now uses
``NaN``:

.. ipython:: python
.. 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.

there should be only space between the .. and ipython. Here, and in all the cases that follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, i will work on it ASAP.

@@ -86,7 +81,8 @@ For full docs, see the :ref:`categorical introduction <categorical>` and the
df["grade"].cat.categories = ["very good", "good", "very bad"]

# Reorder the categories and simultaneously add the missing categories
df["grade"] = df["grade"].cat.set_categories(["very bad", "bad", "medium", "good", "very good"])
df["grade"] = df["grade"].cat.set_categories(
["very bad", "bad", "medium", "good", "very good"])
Copy link
Member

Choose a reason for hiding this comment

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

better something like:

df["grade"] = df["grade"].cat.set_categories(["very bad",
                                              "bad",
...

@datapythonista datapythonista self-assigned this Dec 30, 2018
@jreback
Copy link
Contributor

jreback commented Jan 1, 2019

can you merge master and update

@jreback
Copy link
Contributor

jreback commented Jan 2, 2019

@joybh98
Copy link
Contributor Author

joybh98 commented Jan 2, 2019

@datapythonista in v0.15.0,all pd,df are giving invalid syntax error,how can this be removed ?

@jorisvandenbossche
Copy link
Member

Note there are still a bunch of failures in the doc build related to the clean-up (see eg https://travis-ci.org/pandas-dev/pandas/jobs/474277960)

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Forget about the syntax errors, and any previous comment. Just fix the comments in this review, we'll merged the changes, and anything remaining will be addressed in a separate PR.

ts
ts.tz_localize(None)

didx = DatetimeIndex(start='2014-08-01 09:00', freq='H', periods=10, tz='US/Eastern')
didx = pd.DatetimeIndex(
Copy link
Member

Choose a reason for hiding this comment

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

better:

didx = pd.DatetimeIndex(start='2014-08-01 09:00',
...

df["grade"] = df["grade"].cat.set_categories(["very bad", "bad", "medium", "good", "very good"])
df["grade"] = df["grade"].cat.set_categories(["very bad",
"bad", "medium",
"good", "very good"]
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 needs to be at the same level as the previos. The ) in the next line should be at the end of this.

data = dict([ (t, np.random.randint(100, size=n).astype(t))
for t in dtypes])
df = DataFrame(data)
data = [(t, np.random.randint(100, size=n).astype(t))
Copy link
Member

Choose a reason for hiding this comment

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

data must be a dict, restore the previous

Out[7]:
0 NaN
1 1.0
2 5.2
dtype: float64

In [8]: pd.ewma(Series([1., None, 8.]), com=2., ignore_na=True) # pre-0.15.0 behavior
In [8]: pd.ewma(pd.Series
([1., None, 8.]), com=2., ignore_na=True) # pre-0.15.0 behavior
Copy link
Member

Choose a reason for hiding this comment

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

restore the previous

Out[8]:
0 1.0
1 1.0
2 5.2
dtype: float64

In [9]: pd.ewma(Series([1., None, 8.]), com=2., ignore_na=False) # new default
In[9]: pd.ewma(
Copy link
Member

Choose a reason for hiding this comment

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

restore the previous

.. ipython:: python
:supress:
df = pd.DataFrame()
ts = pd.Timestamp()
Copy link
Member

Choose a reason for hiding this comment

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

remove this for now.


.. code-block:: ipython
Copy link
Member

Choose a reason for hiding this comment

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

restore the original

@@ -233,7 +231,8 @@ Enhancements

.. ipython:: python

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

Choose a reason for hiding this comment

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

restore the original, fix the missing spaces only

@@ -154,7 +148,7 @@ Other enhancements:
.. code-block:: python

from sqlalchemy.types import String
data.to_sql('data_dtype', engine, dtype={'Col_1': String})
data.to_sql('data_dtype', pd.engine, dtype={'Col_1': String})
Copy link
Member

Choose a reason for hiding this comment

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

restore the original

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
Copy link
Member

Choose a reason for hiding this comment

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

restore the original, don't leave any changes to this file


This will return a Series, indexed like the existing Series. See the :ref:`docs <basics.dt_accessors>`
.. 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::)

Out[8]:
0 1.0
1 1.0
2 5.2
dtype: float64

In [9]: pd.ewma(Series([1., None, 8.]), com=2., ignore_na=False) # new default
In[9]: pd.ewma(pd.Series([1., None, 8.]), com=2., ignore_na=False) # new default

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?

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?

@@ -792,13 +791,13 @@ Other notable API changes:

This is now the correct behavior

.. ipython:: python
.. 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.

revert the addition of the space here (sphinx is very sensitive to this kind of things ..)

@@ -814,13 +813,13 @@ Other notable API changes:
In prior versions this would drop the timezone, now it retains the timezone,
but gives a column of ``object`` dtype:

.. ipython:: python
.. 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.

same here, and in a couple of ones below

@@ -835,9 +834,9 @@ Other notable API changes:

- ``SettingWithCopy`` raise/warnings (according to the option ``mode.chained_assignment``) will now be issued when setting a value on a sliced mixed-dtype DataFrame using chained-assignment. (:issue:`7845`, :issue:`7950`)

.. code-block:: python
.. code-block:: ipython
Copy link
Member

Choose a reason for hiding this comment

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

remove space

on an ``errors`` argument, as well as a list of hard-coded country codes and
- World Bank data requests now will warn/raise based
Copy link
Member

Choose a reason for hiding this comment

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

undo this switching of the lines

@datapythonista
Copy link
Member

Closing this, it's been like 4 or 5 times that we request the same changes in the reviews. This is taking to much of our time to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: Fix flake8 issues in doc/source/whatsnew/v0.15.*.rst
4 participants