Here are two main reasons:
-
As of Python 3.6, the tzinfo documentation recommends dateutil.tz rather than pytz as an IANA time zone provider.
-
Pandas supports dateutil timezones.
When having a pandas DataFrame that uses a dateutil timezone, you get an error.
Below is a code sample:
import dateutil
tz = dateutil.tz.gettz('Asia/Shanghai')
df = pd.DataFrame({'a': list(range(1, 4)), 'b': pd.date_range('20130101', periods=3, tz=tz)})
df.to_feather('df.feather')
Errors:
ArrowInvalid: ('Object returned by tzinfo.utcoffset(None) is not an instance of datetime.timedelta', "Conversion failed for column b with type datetime64[ns, tzfile('/usr/share/zoneinfo/Asia/Shanghai')]")
Reporter: Eric Du
Related issues:
Note: This issue was originally created as ARROW-10936. Please see the migration documentation for further details.
Here are two main reasons:
As of Python 3.6, the tzinfo documentation recommends
dateutil.tzrather thanpytzas an IANA time zone provider.Pandas supports dateutil timezones.
When having a pandas DataFrame that uses a dateutil timezone, you get an error.
Below is a code sample:
Errors:
Reporter: Eric Du
Related issues:
Note: This issue was originally created as ARROW-10936. Please see the migration documentation for further details.