arrow
arrow copied to clipboard
Pandas Timestamp from Arrow Object
Issue Description
I read #755 and thought that Arrow objects supposed to work with pandas TimeStamp object. However, I couldn't get them to work together without accessing the property "naive".
The Arrow objects couldn't be parsed using pd.to_datetime
I couldn't sliced pandas Timestamp using Arrow objects as well. Is this how it's supposed to be?
I really like arrow that I can get the floor and ceiling of a frame so fast, however, it's kind of quirky to have to access .naive everytime I interact with pandas
System Info
- 🖥 OS name and version: Debian Linux 11.5
- 🐍 Python version: 3.10.6
- 🏹 Arrow version: 1.2.3
I could add a custom function like to_pandas() instead of using .naive everytime ex:
def to_pandas(self):
"""
Convert Arrow object to pandas.Timestamp, handling timezones appropriately.
"""
if self.tzinfo:
return pd.Timestamp(self.datetime, tz=self.tzinfo)
return pd.Timestamp(self.datetime)
@NikkiSatmaka @jadchaar if this approach is fine, I can make a PR