-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
BugClosing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsDatetimeDatetime data dtypeDatetime data dtypeNeeds InfoClarification about behavior needed to assess issueClarification about behavior needed to assess issueTransformationse.g. cumsum, diff, ranke.g. cumsum, diff, rank
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
df = pd.DataFrame({"date": ['2022-01-01', '2023-01-01']}).astype({"date": "datetime64[ns]"})
print(df.date.diff())
df = pd.DataFrame({"date": ['2022-01-01', '2023-01-01']}).astype({"date": "datetime64[s]"})
print(df.date.diff())
Issue Description
I'm expecting the difference to be 365 days on both, however on the second example the difference ends up coming in nanoseconds as opposed to seconds.
Expected Behavior
Expecting the diff to be 365 days on both
Installed Versions
Replace this line with the output of pd.show_versions()
Metadata
Metadata
Assignees
Labels
BugClosing CandidateMay be closeable, needs more eyeballsMay be closeable, needs more eyeballsDatetimeDatetime data dtypeDatetime data dtypeNeeds InfoClarification about behavior needed to assess issueClarification about behavior needed to assess issueTransformationse.g. cumsum, diff, ranke.g. cumsum, diff, rank