Skip to content

DOC: fix code-block in the reshaping docs #28838

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 10 commits into from
Oct 16, 2019
Merged

DOC: fix code-block in the reshaping docs #28838

merged 10 commits into from
Oct 16, 2019

Conversation

oktaysabak
Copy link
Contributor

@oktaysabak oktaysabak commented Oct 8, 2019

if I wrote only .. code-block:: it shows in github truly but its not passing tests,. so I select python language for code-block
@oktaysabak
Copy link
Contributor Author

@oktaysabak
Copy link
Contributor Author

I think we should change ".. code-block::" to ".. code:: " so its about linting problem.

@oktaysabak
Copy link
Contributor Author

This is a useful link

@oktaysabak oktaysabak changed the title fix code-block in the reshaping docs DOC: fix code-block in the reshaping docs Oct 8, 2019
I change the "space size before ". I hope it will pass the checks
Finally I found the solution.  
`E999 SyntaxError: invalid syntax causes flake8 to skip AST tests. Keep mandatory E999 issues in blocks with :flake8-group: Ignore to preserve full testing for the rest of the blocks.`
[link is here](https://pypi.org/project/flake8-rst/)
@oktaysabak
Copy link
Contributor Author

Finally I found the solution.
E999 SyntaxError: invalid syntax causes flake8 to skip AST tests. Keep mandatory E999 issues in blocks with :flake8-group: Ignore to preserve full testing for the rest of the blocks.
link is here

@jreback jreback added the Docs label Oct 8, 2019
@oktaysabak
Copy link
Contributor Author

oktaysabak commented Oct 8, 2019

if I add a whitespace after .. code-block:: flake8-rst works good but your script ! grep -n '--exclude=*.'{svg,c,cpp,html,js} --exclude-dir=env -RI "\s$" * | awk -F ":" '{print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";] Tailing whitespaces found: " $3}' gives error.

So I will change code-block to .. code::

If I convert it to .. code:: it won't give E999 flake8 error and tailing whitespaces error.

I test it manually from my local computer. I hope it will work and I think this is a bug.

row2 0.13 NaN 0.395 0.500 0.25
row3 NaN 0.310 NaN 0.545 NaN
row4 NaN 0.100 0.395 0.760 0.24
.. code-block:: html
Copy link
Member

Choose a reason for hiding this comment

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

This should not be highlighted as html. I think you can probably use just :: instead for having a code block without any highlighting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello Joris, when I use without highlighting checks failing on AzureDevops because flake8-rst giving E999 syntax error. You should break a 'space' after "::", but when I break a space the end of line, ci/code_checks.sh gives linting error. The AzureDevops fails again.

Copy link
Member

Choose a reason for hiding this comment

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

I think you should remove the .. code-block:: html line, and in the previous have should look like:: (see the double colon).

If that doesn't work, try .. code-block:: text or .. code-block:: none

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I will change it to .. code-block::
You will see the AzureDevops fail on flake8-rst

Copy link
Member

Choose a reason for hiding this comment

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

I guess the default for code-block is Python, and flake-rst is validating the content of the block assuming it's Python code, hence the syntax error.

In any case, can you implement one of the proposed options @oktaysabak please. Not so important to understand the details of the problem, let's simply fix it and get this merged.

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 flake8-rst wants a ' ' blank after .. code-block:: like this. But if I leave a blank end of line; pandas code checker fails.( ci/code_checks.sh ) So I will change it to the .. code-block:: text than I will test it locally. I hope it will fix.

@datapythonista
Copy link
Member

Thanks! Did you render the html? do you mind copying a screenshot to see how it looks?

@oktaysabak
Copy link
Contributor Author

Thanks! Did you render the html? do you mind copying a screenshot to see how it looks?

Yes I rendered it on my local machine.

image link

( imgur was banned in Turkey. So I uploaded the screenshot to this site. )

row2 0.13 NaN 0.395 0.500 0.25
row3 NaN 0.310 NaN 0.545 NaN
row4 NaN 0.100 0.395 0.760 0.24
.. code-block:: text
Copy link
Contributor

Choose a reason for hiding this comment

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

I still dont' think this will format corectly; rather than trying to fix it this way, simply create a DataFrame and show it.

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 initially thought of doing so. but requested only 'change note to the code-block'. If you want I can change it to the DataFrame then call it on .. code-block:: ipython

Copy link
Contributor

Choose a reason for hiding this comment

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

well, does this actually render the same as a dataframe?

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 created a example_dataframe variable. Result after rendering looks like this: link
If you OK, I can commit my changes

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 created a example_dataframe variable. Result after rendering looks like this: link
If you OK, I can commit my changes

*i will write DataFrame values on original 'reshaping.rst' file, this values only for show render results.

Copy link
Member

Choose a reason for hiding this comment

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

@jreback the point of this block in the docs is to show a possible result, and not an actual dataframe. The full section could maybe be rewritten, but that is outside of scope for this PR.

@jorisvandenbossche
Copy link
Member

@oktaysabak Thanks for the screenshot! That's looking good, and CI is passing now ;) So merging, thanks again for your contribution!

@jorisvandenbossche jorisvandenbossche merged commit 5ad908e into pandas-dev:master Oct 16, 2019
@jorisvandenbossche jorisvandenbossche added this to the 1.0 milestone Oct 16, 2019
@oktaysabak
Copy link
Contributor Author

This is my first merge in a big project. Thank you !

proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
bongolegend pushed a commit to bongolegend/pandas that referenced this pull request Jan 1, 2020
@oktaysabak oktaysabak deleted the patch-1 branch January 31, 2020 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: fix code-block in the reshaping docs
4 participants