Skip to content

BUG: changing period array formats to specified date formats in to_csv #51700

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

Closed

Conversation

lia2710
Copy link
Contributor

@lia2710 lia2710 commented Feb 28, 2023

  • This is intended to fix BUG: to_csv date_format is not taken into account for PeriodArrays #51621
  • This issue is that PeriodArrays can not change to the specified date_format in to_csv.
  • The cause is that PeriodArray is established as NDArrayBackedExtensionBlock instead of DatetimeLikeBlock so that df._mgr.to_native_types does not change 'PeriodArray' to desired string format. This fix is added in after df._mgr.to_native_types to change Period to specified date_format.
  • One unit test is added.

@lia2710 lia2710 marked this pull request as draft March 1, 2023 00:37
data = [res.iget_values(i) for i in range(len(res.items))]
data = [
self._change_to_str_date_format(res.iget_values(i))
for i in range(len(res.items))
Copy link
Member

Choose a reason for hiding this comment

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

This is the wrong place for this. We have formatters per dtype, it would have to be added there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. Thanks for pointing it out. Very helpful.

@mroeschke mroeschke added IO CSV read_csv, to_csv Period Period data type labels Mar 17, 2023
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Apr 17, 2023
@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO CSV read_csv, to_csv Period Period data type Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: to_csv date_format is not taken into account for PeriodArrays
3 participants