Skip to content

Allow datetime values to be subtracted from a Series to create a TimedeltaSeries #323

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

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

gandhis1
Copy link
Contributor

  • Tests added: Please use assert_type() to assert the type of any return value
In [2]: import pandas as pd
   ...: from datetime import datetime
   ...: s = pd.Series(pd.date_range("1/1/2020", "2/1/2020"))
   ...: s - datetime.now()
Out[2]: 
0    -995 days +02:03:18.373842
1    -994 days +02:03:18.373842
2    -993 days +02:03:18.373842
3    -992 days +02:03:18.373842
4    -991 days +02:03:18.373842
5    -990 days +02:03:18.373842
6    -989 days +02:03:18.373842
7    -988 days +02:03:18.373842
8    -987 days +02:03:18.373842
9    -986 days +02:03:18.373842
10   -985 days +02:03:18.373842
11   -984 days +02:03:18.373842
12   -983 days +02:03:18.373842
13   -982 days +02:03:18.373842
14   -981 days +02:03:18.373842
15   -980 days +02:03:18.373842
16   -979 days +02:03:18.373842
17   -978 days +02:03:18.373842
18   -977 days +02:03:18.373842
19   -976 days +02:03:18.373842
20   -975 days +02:03:18.373842
21   -974 days +02:03:18.373842
22   -973 days +02:03:18.373842
23   -972 days +02:03:18.373842
24   -971 days +02:03:18.373842
25   -970 days +02:03:18.373842
26   -969 days +02:03:18.373842
27   -968 days +02:03:18.373842
28   -967 days +02:03:18.373842
29   -966 days +02:03:18.373842
30   -965 days +02:03:18.373842
31   -964 days +02:03:18.373842
dtype: timedelta64[ns]

@gandhis1 gandhis1 marked this pull request as ready for review September 22, 2022 01:58
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @gandhis1

@Dr-Irv Dr-Irv merged commit 7073358 into pandas-dev:main Sep 22, 2022
@gandhis1 gandhis1 deleted the series_sub branch September 22, 2022 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants