-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Typing: Narrow down types of arguments (NDFrame) #10 #52754
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your pr
pandas/core/generic.py
Outdated
@@ -2276,7 +2276,7 @@ def to_json( | |||
date_format: str | None = None, | |||
double_precision: int = 10, | |||
force_ascii: bool_t = True, | |||
date_unit: str = "ms", | |||
date_unit: Literal["s", "ms", "us", "ns"] = "ms", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one seems broadly useful - perhaps let's define it as TimeUnit
in _typing.py
and import it here?
pandas/core/generic.py
Outdated
complevel: int | None = None, | ||
complib: str | None = None, | ||
complib: ["zlib", "lzo", "bzip2", "blosc"] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing literal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change addressed problems
Thanks for the PR @mKlepsch! The CI caught some errors which I think you can solve locally if you run pre-commit. Let us know if you need help. |
Hope it works now! |
removed the new line in the import
Hi, I can't figure out why it is still failing the CI. Could you give me some pointers? |
you'll need to run the pre-commit hooks, please check the contributing guide for how to do that |
You can do:
(It's probably a space at the end of the line, which is disallowed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good after fixing pre-commit
Thanks @mKlepsch |
…s-dev#52754) * improved specificationfor date_unit in to_json more precisely * improved specification mode in to_hdf * added the Literal to complib of to_hdf * improved format for to_hdf * address PR review * Update generic.py removed the new line in the import * ran "pre-commit" to fix trailing whitespace
…s-dev#52754) * improved specificationfor date_unit in to_json more precisely * improved specification mode in to_hdf * added the Literal to complib of to_hdf * improved format for to_hdf * address PR review * Update generic.py removed the new line in the import * ran "pre-commit" to fix trailing whitespace
Typing: Narrow down types of arguments (NDFrame) #10
Made these specifications to Literals:
@phofl @jorisvandenbossche @noatamir @MarcoGorelli