Skip to content

DOC: doc/source/whatsnew #36857

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 8 commits into from
Oct 5, 2020
Merged

DOC: doc/source/whatsnew #36857

merged 8 commits into from
Oct 5, 2020

Conversation

meghanacosmos
Copy link
Contributor

@meghanacosmos meghanacosmos commented Oct 4, 2020

@meghanacosmos meghanacosmos marked this pull request as ready for review October 4, 2020 11:13
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -354,15 +362,15 @@ Some East Asian countries use Unicode characters its width is corresponding to 2

.. ipython:: python

df = pd.DataFrame({u'国籍': ['UK', u'日本'], u'名前': ['Alice', u'しのぶ']})
df;
Copy link
Member

@MarcoGorelli MarcoGorelli Oct 4, 2020

Choose a reason for hiding this comment

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

@dsaxton I guess the semi-colon should stay here? Might be a case of manually changing something that was changed by blacken-docs

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 so, it looks like it's being added to suppress output (there are some other cases where this is done to prevent matplotlib from printing text to the screen)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I add the semi-colon then? I'll let you know if I find any more like this too. @MarcoGorelli @dsaxton

Copy link
Member

Choose a reason for hiding this comment

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

yes, please do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

data = ('a,b,c\n'
'1,Yes,2\n'
'3,No,4')
data = "a,b,c\n1,Yes,2\n3,No,4"
Copy link
Member

Choose a reason for hiding this comment

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

@jorisvandenbossche made the valid point that this is slightly harder to understand as an input to read_csv, so maybe we use a multiline string similar to this instead (which black is fine with):

data = """
a,b,c
1,Yes,2
3,No,4
"""

What do you think @meghana-12 @MarcoGorelli ?

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'll be making changes in a min then.

Copy link
Member

Choose a reason for hiding this comment

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

This same pattern appears in several places within doc/source/user_guide/io.rst, so if you wanted to tackle those in another PR that would also be very welcome

Copy link
Contributor Author

@meghanacosmos meghanacosmos Oct 4, 2020

Choose a reason for hiding this comment

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

Sure, I'll have a look at it! Are there any tools that'll help me with the issue or they need to be edited manually @dsaxton ?

data = ('0,0,1\n'
'1,1,0\n'
'0,1,0')
data = "0,0,1\n1,1,0\n0,1,0"
Copy link
Member

@MarcoGorelli MarcoGorelli Oct 4, 2020

Choose a reason for hiding this comment

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

Same comment as above from doc/source/whatsnew/v0.10.0.rst (can this be written on multiple lines using """)? After this I think this'll be good to go

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'll make the changes asap.

pd.set_option('display.unicode.east_asian_width', True)
df;
pd.set_option("display.unicode.east_asian_width", True)
df
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is semi-colon need to be added here? @dsaxton @MarcoGorelli

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think we want one here too

@@ -235,17 +246,17 @@ converting to ``Categorical`` after parsing. See the io :ref:`docs here <io.cat

.. ipython:: python

data = 'col1,col2,col3\na,b,1\na,b,2\nc,d,3'
data = "col1,col2,col3\na,b,1\na,b,2\nc,d,3"
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 believe this can be converted into multiline too? @dsaxton @MarcoGorelli

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think that would be good

Copy link
Member

@MarcoGorelli MarcoGorelli Oct 5, 2020

Choose a reason for hiding this comment

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

Sure. There's also a similar line in doc/source/whatsnew/v0.19.0.rst .

Just a generic comment - it doesn't seem to make a difference in these examples, but in general you'll probably want to remove the leading and trailing newlines by ending the first and last lines with \:

In [7]: data = """
   ...: a,b,c
   ...: 1,Yes,2
   ...: """

In [8]: data
Out[8]: '\na,b,c\n1,Yes,2\n'

In [9]: data = """\
   ...: a,b,c
   ...: 1,Yes,2\
   ...: """

In [10]: data
Out[10]: 'a,b,c\n1,Yes,2'

See how the second example (starting with """\ matches the string 'a,b,c\n1,Yes,2' while the first one has extra newlines)

Copy link
Member

Choose a reason for hiding this comment

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

In these examples the extra newlines don't affect the result

In [15]: data = """\
    ...: a,b,c
    ...: 1,Yes,2\
    ...: """

In [16]: pd.read_csv(io.StringIO(data))
Out[16]:
   a    b  c
0  1  Yes  2

In [17]: data = """
    ...: a,b,c
    ...: 1,Yes,2
    ...: """

In [18]: pd.read_csv(io.StringIO(data))
Out[18]:
   a    b  c
0  1  Yes  2

so no need to add these \ here, it's just something to be aware of in case you change to multi-line format in other parts of the docs and there is does make a difference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! Okay! Thank you, I'll remember that! Shall I see if the ones I updated are affected by this or not? And make changes accordingly?

Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure all the ones you updated here are the same as this one (pd.read_csv(io.stringio(... so I think we're fine here

As for whether there are any tools to do this automatically - I don't think so 😢

If you update the line in line in doc/source/whatsnew/v0.19.0.rst then I think this is good to go!

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, my bad, this is v0.19.0, you updated it already.

Cool, looks good to me!

@dsaxton dsaxton merged commit 8b00440 into pandas-dev:master Oct 5, 2020
@dsaxton
Copy link
Member

dsaxton commented Oct 5, 2020

Thanks @meghana-12

@meghanacosmos
Copy link
Contributor Author

meghanacosmos commented Oct 5, 2020

Hey, @dsaxton @MarcoGorelli I have a small request. If you find this PR good enough to be part of hacktoberfest, could you please add the label hacktoberfest-accepted?

@MarcoGorelli
Copy link
Member

Happy to help, let us know if you'd like any help/mentoring with other issues

jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Oct 13, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
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.

3 participants