Skip to content
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

Let pyarrow cast strings to dates #80

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

scottyhq
Copy link
Contributor

Addresses #79

Comment on lines +49 to +50
"created": "2024-09-10T10:00:00.425293+00:00",
"updated": "2024-09-10T10:00:00.425300+00:00",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

only this first item has these properties set

@@ -1,6 +1,5 @@
"""Convert STAC data into Arrow tables"""

import ciso8601
Copy link
Contributor Author

@scottyhq scottyhq Oct 24, 2024

Choose a reason for hiding this comment

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

since pandas is a dependency, maybe ciso8601 could be dropped as a dependency and instead just use pandas or pyarrow for date handling? see also #31 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely don't want to use pandas here, but using pyarrow natively for the cast is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like the only other place ciso8601 is used currently is in testing here

result_datetime = parse_rfc3339(result)
expected_datetime = parse_rfc3339(expected)

Should I switch that to use pandas or pa.scalar(timestamp_str, type=pa.string()).cast(pa.timestamp('us', tz='UTC')).as_py()?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's fine for ciso8601 to still be used in the tests.

@@ -1,6 +1,5 @@
"""Convert STAC data into Arrow tables"""

import ciso8601
Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely don't want to use pandas here, but using pyarrow natively for the cast is fine.

@kylebarron kylebarron merged commit 0944b44 into stac-utils:main Oct 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants