-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: simplify CSVFormatter #36046
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
REF: simplify CSVFormatter #36046
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
4223349
REF: extract properties cols and has_mi_columns
ivanovmg 58ef283
REF: extract property chunksize
ivanovmg f4fe66d
REF: extract property quotechar
ivanovmg 59a2d21
REF: extract properties data_index and nlevels
ivanovmg 29256d4
REF: refactor _save_chunk
ivanovmg a6e84e1
REF: refactor _save
ivanovmg c840b3f
REF: extract method _save_body
ivanovmg 6828146
REF: reorder _save-like methods
ivanovmg 98d4e47
REF: extract compression property
ivanovmg d6b2827
REF: Extract property index_label
ivanovmg 15dbc83
REF: extract helper properties
ivanovmg 5e7b778
REF: delete local variables in _save_header
ivanovmg 6e3b389
REF: extract method _get_header_rows
ivanovmg d733f0f
REF: move check for header into _save function
ivanovmg cdeb115
TYP: add several type annotations
ivanovmg 417e74a
FIX: fix index labels
ivanovmg 9df1d82
FIX: fix multiindex
ivanovmg 9fd8d13
Merge branch 'master' into refactor/csvs
ivanovmg 22955db
FIX: fix test failures on compression
ivanovmg 5dcff8e
REF: eliminate preallocation of self.data
ivanovmg ff144d8
REF: extract method _convert_to_native_types
ivanovmg 3da7207
REF: rename regular -> flat as reviewed
ivanovmg 6041666
TYP: add type annotations as reviewed
ivanovmg 46f593d
REF: refactor number formatting
ivanovmg 080e6e1
FIX: mypy error with index_label
ivanovmg 1e35f87
FIX: reorder if-statements in index_label
ivanovmg ba353a5
TYP: move IndexLabel to pandas._typing
ivanovmg a49dd63
TYP: quotechar, has_mi_columns, _need_to_save...
ivanovmg f1e1ac8
TYP: chunksize, but ignored assignment check
ivanovmg 1346995
TYP: cols property
ivanovmg bebdfcf
TYP: nlevels and _has_aliases
ivanovmg b381e8a
Merge branch 'master' into refactor/csvs
ivanovmg ca888c1
CLN: move GH21227 check to pandas/io/common.py
ivanovmg b7dae11
TYP: remove redundant bool from IndexLabel type
ivanovmg 1f8c488
TYP: add to _get_index_label... methods
ivanovmg 1a750b4
TYP: use Iterator instead of Generator
ivanovmg 7b89921
TYP: explicitly use List type
ivanovmg 2478084
TYP: correct dict typing
ivanovmg e08f656
TYP: remaining properties
ivanovmg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
the Optional in Label above is to include None in Label. (On hindsight, I think this could have been Union[Hashable, None] for clarity but we don't use the Union[..., None] pattern)
And also I'm not sure how we got the Ordered alias below.
In pandas._typing, I would generally prefer that we don't include the Optional, and just add it when needed in the annotations. I think this in generally allows more use of the aliases (i.e. after setting a default since we don't always set defaults in the signatures)
so in the code, you would have
instead of
of course Label includes None anyway so the Optional isn't needed anyway. it's just a stylistic preference.
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.
@simonjayhawkins, I agree that it is more reasonable to define Label and IndexLabel without Optional. I will take a look at this in a separate PR.