Skip to content

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

Merged
merged 6 commits into from
Jan 29, 2023
Merged

gh-520: Removed unnecassary types from S1 #522

merged 6 commits into from
Jan 29, 2023

Conversation

ramvikrams
Copy link
Contributor

@ramvikrams ramvikrams commented Jan 28, 2023

I didn't delete datetime.date , dateitme.time it was called many times in funcs

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.

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.

@ramvikrams ramvikrams changed the title gh-520: Modified S1 gh-520: Removed unnecassary types from S1 Jan 29, 2023
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.

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.

@ramvikrams
Copy link
Contributor Author

ramvikrams commented Jan 29, 2023

So can you revert the changes you made corresponding to dt.date and dt.time ?

Yes sir

Sorry for misleading you.

No problem Sir, everyone of us makes mistake, thanks for having such great attitude and values.

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 @ramvikrams

@Dr-Irv Dr-Irv merged commit 68f4d5f into pandas-dev:main Jan 29, 2023
@ramvikrams
Copy link
Contributor Author

Thanks @ramvikrams

thanks sir

twoertwein pushed a commit to twoertwein/pandas-stubs that referenced this pull request Apr 1, 2023
* Modified S1

* Removed two datetime.*

* req. changes

* typo changes

* removed datetime.* and modified the test likewise

* Reverting changes made in last commit
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.

CLEAN: Remove some unnecessary types from S1
2 participants