-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: pandas/io/sql.py (easy: bool/str) #38537
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
Conversation
chunksize: Optional[str], | ||
columns, | ||
coerce_float: bool = True, | ||
parse_dates=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.
is this one correct? parse_dates
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.
I actually didn't touch this, but looking through these read_sql methods parse_dates defaults to None in most (I think all) of those
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.
maybe i pointed at the wrong one, this shouldn't be a bool type for parse_dates right? it takes a Optional[Dict[str, ....]]
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.
Ah yes it's one up from here.
Fixed (removed the annotation - sticking to doing plain bool/str in this PR)
pandas/io/sql.py
Outdated
@@ -77,7 +77,7 @@ def _process_parse_dates_argument(parse_dates): | |||
return parse_dates | |||
|
|||
|
|||
def _handle_date_column(col, utc=None, format=None): | |||
def _handle_date_column(col, utc: Optional[bool] = None, format: Optional[str] = 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.
format is not right, itls something like Optional[Union[Dict[str, str], str]]
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.
yes definitely a mistake
I think it has to be Optional[Dict[str, Any]]
because it ends up in
to_datetime(col, errors=error, **format)
Can also be str
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.
Pushed the fix
thanks @arw2019 |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff