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

DOC: Update to docstring of DataFrame(dtype) (#14764) #16487

Merged
merged 7 commits into from
May 31, 2017
Merged

DOC: Update to docstring of DataFrame(dtype) (#14764) #16487

merged 7 commits into from
May 31, 2017

Conversation

VincentLa
Copy link
Contributor

@VincentLa VincentLa commented May 24, 2017

@VincentLa VincentLa changed the title [Issue: 14764] [Issue: 14764] DOC: Update to docstring of pd.DataFrame(dtype) May 24, 2017
@codecov
Copy link

codecov bot commented May 24, 2017

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #16487   +/-   ##
=======================================
  Coverage    90.4%    90.4%           
=======================================
  Files         161      161           
  Lines       51033    51033           
=======================================
  Hits        46136    46136           
  Misses       4897     4897
Flag Coverage Δ
#multiple 88.24% <0%> (ø) ⬆️
#single 40.17% <0%> (ø) ⬆️

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 97ad3fb...7ae1e3e. Read the comment docs.

@codecov
Copy link

codecov bot commented May 24, 2017

Codecov Report

Merging #16487 into master will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16487      +/-   ##
==========================================
- Coverage   90.79%   90.75%   -0.05%     
==========================================
  Files         161      161              
  Lines       51063    51071       +8     
==========================================
- Hits        46365    46348      -17     
- Misses       4698     4723      +25
Flag Coverage Δ
#multiple 88.59% <ø> (-0.05%) ⬇️
#single 40.11% <ø> (-0.05%) ⬇️
Impacted Files Coverage Δ
pandas/core/frame.py 97.66% <ø> (ø) ⬆️
pandas/io/formats/terminal.py 16.43% <0%> (-31.39%) ⬇️
pandas/core/window.py 96.49% <0%> (+0.01%) ⬆️

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 ef487d9...edc1c04. Read the comment docs.

@@ -241,17 +241,52 @@ class DataFrame(NDFrame):
Column labels to use for resulting frame. Will default to
np.arange(n) if no column labels are provided
dtype : dtype, default None
Data type to force, otherwise infer
Data type to force. Only a single dtype is allowed. If None, infer
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not right. you can pass a dict of dtypes.

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 interesting. How? This does not work for me:

d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d, dtype={'col1': np.int64, 'col2': np.int64})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to #4464 and #9133 it seems like this is not yet implemented.

Copy link
Contributor

Choose a reason for hiding this comment

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

#13375 implemented his for astype
hasn't been implemented for construction

... columns=['a', 'b', 'c', 'd', 'e'])
>>> df2
a b c d e
Copy link
Contributor

Choose a reason for hiding this comment

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

these are not lined up, something odd going on.

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 think this is ok? It comes out looking like this when I generated
screen shot 2017-05-24 at 4 18 57 pm

Copy link
Contributor

Choose a reason for hiding this comment

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

can you line up on the decimals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure I'll just change the example to something easier with integers to take up less space anyway.

@jreback jreback added the Docs label May 24, 2017
@jorisvandenbossche jorisvandenbossche changed the title [Issue: 14764] DOC: Update to docstring of pd.DataFrame(dtype) DOC: Update to docstring of DataFrame(dtype) (#14764) May 31, 2017
Copy link
Member

@jorisvandenbossche jorisvandenbossche 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! (I did a small cosmetic edit, see latest commit)

@jorisvandenbossche jorisvandenbossche merged commit fbdae2d into pandas-dev:master May 31, 2017
@jorisvandenbossche
Copy link
Member

@VincentLa Thanks!

@jorisvandenbossche jorisvandenbossche added this to the 0.21.0 milestone May 31, 2017
@VincentLa VincentLa deleted the issue-14764 branch May 31, 2017 15:34
Kiv pushed a commit to Kiv/pandas that referenced this pull request Jun 11, 2017
…as-dev#16487)

* Adding some more documentation on dataframe with regards to dtype

* Making example for creating dataframe from np matrix easier
stangirala pushed a commit to stangirala/pandas that referenced this pull request Jun 11, 2017
…as-dev#16487)

* Adding some more documentation on dataframe with regards to dtype

* Making example for creating dataframe from np matrix easier
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: pd.DataFrame(dtype) arg cannot be list, dict, Series. And None will infer wider type than necessary.
3 participants