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 pd.DataFrame(dtype) #14868

Closed
wants to merge 2 commits into from
Closed

DOC: Update to docstring of pd.DataFrame(dtype) #14868

wants to merge 2 commits into from

Conversation

patniharshit
Copy link
Contributor

@patniharshit patniharshit commented Dec 12, 2016

All suggestions to improve this are welcome.

@@ -231,6 +231,23 @@ class DataFrame(NDFrame):
>>> df3 = DataFrame(np.random.randn(10, 5),
... columns=['a', 'b', 'c', 'd', 'e'])

Exceptional Behaviour
Copy link
Contributor

Choose a reason for hiding this comment

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

should read Examples

@jreback jreback added Docs Dtype Conversions Unexpected or buggy dtype conversions labels Dec 12, 2016
@codecov-io
Copy link

Current coverage is 85.26% (diff: 100%)

Merging #14868 into master will not change coverage

@@             master     #14868   diff @@
==========================================
  Files           144        144          
  Lines         50980      50980          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43470      43470          
  Misses         7510       7510          
  Partials          0          0          

Powered by Codecov. Last update 14e4815...6ee14e7

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Dec 14, 2016

Personally, I am not convinced that these examples are needed in the DataFrame docstring

  • "Leaving dtype=None in constructor will infer a wider type than necessary" -> these are just the default dtypes, so I would phrase it in any case differently
  • "A list/dict/Series/array-like is not allowed." -> We should just clarify in the explanation of the parameter above that "only a single dtype is allowed". Or maybe rephrase the example to just show that you can specify a single dtype.
  • "Fix up dtypes after declaration" -> Also, I don't think this is needed here. Could maybe go somewhere in the tutorial docs.

@jorisvandenbossche
Copy link
Member

@patniharshit Can you update?

@patniharshit
Copy link
Contributor Author

yeah sure

@@ -231,6 +231,21 @@ class DataFrame(NDFrame):
>>> df3 = DataFrame(np.random.randn(10, 5),
... columns=['a', 'b', 'c', 'd', 'e'])

Leaving dtype=None in constructor will infer a wider type than necessary
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 show an a typical example of passing a dtype, with a single type, then multiple types, then this example.

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean by an example passing multiple types? Is that possible to pass in multiple types?

month int64
year int64

A list/dict/Series/array-like is not allowed. Also behaves differently to read_csv(dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure what you are trying to show here, this is just confusing (after line 241)

@jreback
Copy link
Contributor

jreback commented Feb 27, 2017

can you rebase / update

@patniharshit
Copy link
Contributor Author

I am extremely sorry to say that I won't be able to complete this now. Either someone take this up or feel free to close/delete this.

@jreback
Copy link
Contributor

jreback commented Feb 27, 2017

thanks @patniharshit np problem.

@jreback jreback closed this Feb 27, 2017
@jorisvandenbossche jorisvandenbossche added this to the No action milestone Feb 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Dtype Conversions Unexpected or buggy dtype conversions
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.
5 participants