-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-9528: [Python] Honor tzinfo when converting from datetime #7816
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
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8e61432
ARROW-9223: [Python] Propagate timezone information in pandas conversion
emkornfield 69511b5
Honor tzinfo when converting from datetime
emkornfield 5700909
better timezone support
kszucs 3c4f071
test time conversions
kszucs 793e68e
Expost TzinfoToString on the C++ side
kszucs 2f131d3
Add more tests and reorganize implementation
kszucs e007cb1
Add timezone inference
kszucs 25f9b25
Enable tests for nanosecond resolution
kszucs 33b978f
Fix array from scalar test case
kszucs 973259d
Convert from mixed builtin and pandas datetimes
kszucs 29527d0
Skip test_tzinfo_to_string_errors for python versions <=3.6
kszucs 2be7a9e
Fix skip condition
kszucs d5c890f
fix typos
emkornfield 6a5d9f8
Add fallback parameter to ignore timezone in C++ python code
emkornfield 263517d
add ARROW_NO_TZ env variable to revert back to old behavior
emkornfield 9680e1c
use env variable in psark script
emkornfield c8c22f9
ARROW_NO_TZ -> PYARROW_IGNORE_TZ
emkornfield 463a0c4
address review comments
kszucs d4cc519
properly test nested struct roundtrip
kszucs 97e4237
address review comments
kszucs 498d743
use OwnedRef to cleanup tzobject
kszucs 2f5dbf6
fix test_tzinfo_to_string_errors test case
kszucs f5d44e7
clang format
kszucs 880f344
TZ->TIMEZONE
emkornfield 7a658cd
fix doc comments
emkornfield 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,6 +157,32 @@ inline int64_t PyDelta_to_ns(PyDateTime_Delta* pytimedelta) { | |
| return PyDelta_to_us(pytimedelta) * 1000; | ||
| } | ||
|
|
||
| ARROW_PYTHON_EXPORT | ||
|
||
| Result<int64_t> PyDateTime_utcoffset_s(PyObject* pydatetime); | ||
|
|
||
| /// \brief Convert a time zone name into a time zone object. | ||
| /// | ||
| /// Supported input strings are: | ||
| /// * As used in the Olson time zone database (the "tz database" or | ||
| /// "tzdata"), such as "America/New_York" | ||
| /// * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30 | ||
| /// GIL must be held when calling this method. | ||
| ARROW_PYTHON_EXPORT | ||
| Result<PyObject*> StringToTzinfo(const std::string& tz); | ||
|
|
||
| /// \brief Convert a time zone object to a string representation. | ||
| /// | ||
| /// The output strings are: | ||
| /// * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30 | ||
| /// if the input object is either an instance of pytz._FixedOffset or | ||
| /// datetime.timedelta | ||
| /// * The timezone's name if the input object's tzname() method returns with a | ||
| /// non-empty timezone name such as "UTC" or "America/New_York" | ||
| /// | ||
| /// GIL must be held when calling this method. | ||
| ARROW_PYTHON_EXPORT | ||
| Result<std::string> TzinfoToString(PyObject* pytzinfo); | ||
kszucs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| } // namespace internal | ||
| } // namespace py | ||
| } // namespace arrow | ||
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.
Uh oh!
There was an error while loading. Please reload this page.