Skip to content
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

Update examples with imports #16424

Closed
wants to merge 3 commits into from
Closed

Update examples with imports #16424

wants to merge 3 commits into from

Conversation

virajmparekh
Copy link

Variable ts1, ts2, and index are never defined in dataframe df. Should ts1 and ts2 be strings and can we get rid of the index variable?

@@ -247,11 +247,13 @@ class DataFrame(NDFrame):

Examples
--------
>>> import numpy as np
>>> import pandas as pd
Copy link
Member

Choose a reason for hiding this comment

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

Those two are not needed (we assume those, to not have to repeat those in each docstring. Also the tutorial docs everywhere assume those two imports)

@jorisvandenbossche
Copy link
Member

What do you mean with "variable ts1, ts2,"?
In which docstring are they included? (I don't see them in the DataFrame one)

@TomAugspurger
Copy link
Contributor

@jorisvandenbossche they are in the DataFrame class docstring

    Examples
    --------
    >>> d = {'col1': ts1, 'col2': ts2}
    >>> df = DataFrame(data=d, index=index)
    >>> df2 = DataFrame(np.random.randn(10, 5))
    >>> df3 = DataFrame(np.random.randn(10, 5),
    ...                 columns=['a', 'b', 'c', 'd', 'e'])

@vparekh94 it'd be nice to expand that a bit with text in between each explaining the data being passed in. Like

    Examples
    --------
    From a dictionary of arrays:

    >>> d = {'col1': ts1, 'col2': ts2}
    >>> df = DataFrame(data=d, index=index)

    From a 2-D numpy array:

    >>> df2 = DataFrame(np.random.randn(10, 5))

    Same, but setting the column names:

    >>> df3 = DataFrame(np.random.randn(10, 5),
    ...                 columns=['a', 'b', 'c', 'd', 'e'])

(might not have the newlines entirely correct there.

@jorisvandenbossche
Copy link
Member

Oh, I was really blind .. :-)

But indeed, @TomAugspurger 's suggestion is the way to go!

@jreback jreback added the Docs label May 22, 2017
@TomAugspurger TomAugspurger added this to the 0.21.0 milestone May 23, 2017
@TomAugspurger
Copy link
Contributor

@vparekh94 are you able to update this? You can push additional commits to this branch.

@codecov
Copy link

codecov bot commented May 24, 2017

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16424      +/-   ##
==========================================
- Coverage   90.42%   90.42%   -0.01%     
==========================================
  Files         161      161              
  Lines       51023    51023              
==========================================
- Hits        46138    46137       -1     
- Misses       4885     4886       +1
Flag Coverage Δ
#multiple 88.26% <ø> (-0.01%) ⬇️
#single 40.17% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/frame.py 97.69% <ø> (ø) ⬆️
pandas/core/common.py 91.05% <0%> (-0.34%) ⬇️

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 49ec31b...10463c2. Read the comment docs.

@codecov
Copy link

codecov bot commented May 24, 2017

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16424      +/-   ##
==========================================
- Coverage   90.42%   90.42%   -0.01%     
==========================================
  Files         161      161              
  Lines       51023    51023              
==========================================
- Hits        46138    46137       -1     
- Misses       4885     4886       +1
Flag Coverage Δ
#multiple 88.26% <ø> (-0.01%) ⬇️
#single 40.17% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/frame.py 97.69% <ø> (ø) ⬆️
pandas/core/common.py 91.05% <0%> (-0.34%) ⬇️

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 49ec31b...da63094. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Jun 10, 2017

can you rebase and update?

@jorisvandenbossche
Copy link
Member

@vparekh94 sorry for the oversight on out part, but this has been fixed in the meantime in another PR #16487.
Thanks for the contribution anyway!

@jorisvandenbossche jorisvandenbossche modified the milestones: No action, 0.21.0 Aug 7, 2017
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.

4 participants