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

Pandas Timestamp from Arrow Object #1144

Open
NikkiSatmaka opened this issue Nov 23, 2022 · 1 comment
Open

Pandas Timestamp from Arrow Object #1144

NikkiSatmaka opened this issue Nov 23, 2022 · 1 comment
Labels

Comments

@NikkiSatmaka
Copy link

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
@psyuktha
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants