-
-
Notifications
You must be signed in to change notification settings - Fork 141
gh-520: Removed unnecassary types from S1 #522
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the table you did, we should add np.timedelta64
to S1
In pandas-stubs/_libs/tslibs/timestamps.pyi
, for __eq__()
and __ne__()
replace Series[Timestamp]
with Series[np.datetime64]
. Then in test_scalars.py
, change line 1261 to use Series[np.datetime64]
instead of Series[pd.Timestamp]
. I checked this and it will work.
In pandas-stubs/_libs/tslibs/timestamps.pyi
, you have a Series[Timedelta]
for __add__()
that you should remove.
Otherwise, this looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it appears that we should not remove dt.date
and dt.time
now that I see the tests you had to change.
>>> import pandas as pd
>>> i0 = pd.date_range(start="2022-06-01", periods=10)
>>> i0
DatetimeIndex(['2022-06-01', '2022-06-02', '2022-06-03', '2022-06-04',
'2022-06-05', '2022-06-06', '2022-06-07', '2022-06-08',
'2022-06-09', '2022-06-10'],
dtype='datetime64[ns]', freq='D')
>>> s0 = pd.Series(i0)
>>> s0
0 2022-06-01
1 2022-06-02
2 2022-06-03
3 2022-06-04
4 2022-06-05
5 2022-06-06
6 2022-06-07
7 2022-06-08
8 2022-06-09
9 2022-06-10
dtype: datetime64[ns]
>>> s0.dt.date
0 2022-06-01
1 2022-06-02
2 2022-06-03
3 2022-06-04
4 2022-06-05
5 2022-06-06
6 2022-06-07
7 2022-06-08
8 2022-06-09
9 2022-06-10
dtype: object
>>> s0.dt.date.iloc[0]
datetime.date(2022, 6, 1)
>>> s0.dt.time
0 00:00:00
1 00:00:00
2 00:00:00
3 00:00:00
4 00:00:00
5 00:00:00
6 00:00:00
7 00:00:00
8 00:00:00
9 00:00:00
dtype: object
>>> s0.dt.time.iloc[0]
datetime.time(0, 0)
>>> s0.dt.timetz
0 00:00:00
1 00:00:00
2 00:00:00
3 00:00:00
4 00:00:00
5 00:00:00
6 00:00:00
7 00:00:00
8 00:00:00
9 00:00:00
dtype: object
>>> s0.dt.timetz.iloc[0]
datetime.time(0, 0)
So the tests here:
check(assert_type(s0.dt.date, "pd.Series[dt.date]"), pd.Series, dt.date)
check(assert_type(s0.dt.time, "pd.Series[dt.time]"), pd.Series, dt.time)
check(assert_type(s0.dt.timetz, "pd.Series[dt.time]"), pd.Series, dt.time)
were correct, because what is inside the Series
are dt.date
and dt.time
objects.
So can you revert the changes you made corresponding to dt.date
and dt.time
?
Sorry for misleading you.
Yes sir
No problem Sir, everyone of us makes mistake, thanks for having such great attitude and values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ramvikrams
thanks sir |
* Modified S1 * Removed two datetime.* * req. changes * typo changes * removed datetime.* and modified the test likewise * Reverting changes made in last commit
S1
#520assert_type()
to assert the type of any return valueI didn't delete
datetime.date , dateitme.time
it was called many times in funcs