Skip to content

Inconsistent Timestamp arithmetic #8554

Closed
@willpan

Description

@willpan

Subtracting a scalar datetime from a series returns timedeltas, but doesn't do the same for a dataframe.

import pandas as pd 
series = pd.Series(pd.date_range('2000-1-1', periods=100), index=range(0, 100))
df = pd.DataFrame(series)
date = pd.Timestamp('1995-1-1')

series - date
#0    1826 days                                                                                 
#1    1827 days                                                                                 
#2    1828 days
# ....   

df - date
#             0
#0  1975-01-01                                                                                  
#1  1975-01-02                                                                                  
#2  1975-01-03
# ....

It seems like both should return timedeltas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions