Skip to content

Commit

Permalink
Fix tz attribute check, it was checking dtype instead of dt
Browse files Browse the repository at this point in the history
I think this will fix the issue reported here:
#2410
  • Loading branch information
sanrodari authored Jun 14, 2024
1 parent 5857368 commit fde5a30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion awswrangler/_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _apply_timezone(df: pd.DataFrame, metadata: dict[str, Any]) -> pd.DataFrame:
if timezone_str:
timezone: datetime.tzinfo = pa.lib.string_to_tzinfo(timezone_str)
_logger.debug("applying timezone (%s) on column %s", timezone, col_name)
if hasattr(df[col_name].dtype, "tz") is False:
if hasattr(df[col_name].dt, "tz") is False:
df[col_name] = df[col_name].dt.tz_localize(tz="UTC")
if timezone is not None and timezone != pytz.UTC and hasattr(df[col_name].dt, "tz_convert"):
df[col_name] = df[col_name].dt.tz_convert(tz=timezone)
Expand Down

0 comments on commit fde5a30

Please sign in to comment.