-
Notifications
You must be signed in to change notification settings - Fork 916
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
Fix to_csv delimiter handling of timestamp format #7023
Fix to_csv delimiter handling of timestamp format #7023
Conversation
Codecov Report
@@ Coverage Diff @@
## branch-0.18 #7023 +/- ##
===============================================
+ Coverage 82.03% 82.23% +0.19%
===============================================
Files 96 96
Lines 16381 16547 +166
===============================================
+ Hits 13438 13607 +169
+ Misses 2943 2940 -3
Continue to review full report at Codecov.
|
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.
Python changes LGTM
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.
LGTM.
I suppose, parsing datetime columns with double quotes will work.
Yes, that already works with every type. |
rerun tests |
Closes #6699
The timestamp format(s) used by the CSV writer have the form
%Y-%m-%dT%H:%M:%SZ
. This means if the column delimiter','
or the line delimiter\n
is either':'
or'-'
then the timestamp string output could conflict with these delimiters. The current logic simply removed these delimiters from the format if they detected a conflicting column or line delimiter. For example, specifying a dash'-'
as column delimiter caused the timestamp format to change to%Y%m%d...
(the dash is removed). I admit this was kind of hacky and also made the output inconsistent with Pandasto_csv()
.It is easy enough to simply add double-quotes around the timestamp format to prevent these conflicts as well as make the output consistent. This PR fixes that logic.
Exception logic to check for a dash as column separator was also found in csv.py, specifically citing issue 6699 in the exception message. Also, there was a pytest specifically created to check for this exception. The exception is removed and the pytest function updated in this PR as well.