-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
CLN: add typing to dtype arg in selection of files in core/arrays (GH38808) #38826
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
jreback
merged 4 commits into
pandas-dev:master
from
avinashpancham:add_dtype_core_arrays
Dec 31, 2020
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cc99dff
CLN: add typing to dtype arg in selection of files in core/arrays
avinashpancham 776a97a
Change to Dtype
avinashpancham db96d90
Update code to let the tests pass
avinashpancham 6d2642d
Merge remote-tracking branch 'upstream/master' into add_dtype_core_ar…
avinashpancham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
integer_op_not_supported, | ||
round_nsint64, | ||
) | ||
from pandas._typing import DatetimeLikeScalar, DtypeObj | ||
from pandas._typing import DatetimeLikeScalar, Dtype, DtypeObj | ||
from pandas.compat.numpy import function as nv | ||
from pandas.errors import AbstractMethodError, NullFrequencyError, PerformanceWarning | ||
from pandas.util._decorators import Appender, Substitution, cache_readonly | ||
|
@@ -107,15 +107,15 @@ class DatetimeLikeArrayMixin(OpsMixin, NDArrayBackedExtensionArray): | |
_recognized_scalars: Tuple[Type, ...] | ||
_data: np.ndarray | ||
|
||
def __init__(self, data, dtype=None, freq=None, copy=False): | ||
def __init__(self, data, dtype: Optional[Dtype] = None, freq=None, copy=False): | ||
raise AbstractMethodError(self) | ||
|
||
@classmethod | ||
def _simple_new( | ||
cls: Type[DatetimeLikeArrayT], | ||
values: np.ndarray, | ||
freq: Optional[BaseOffset] = None, | ||
dtype=None, | ||
dtype: Optional[Dtype] = None, | ||
) -> DatetimeLikeArrayT: | ||
raise AbstractMethodError(cls) | ||
|
||
|
@@ -265,7 +265,7 @@ def _formatter(self, boxed=False): | |
# ---------------------------------------------------------------- | ||
# Array-Like / EA-Interface Methods | ||
|
||
def __array__(self, dtype=None) -> np.ndarray: | ||
def __array__(self, dtype: Optional[Dtype] = None) -> np.ndarray: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
# used for Timedelta/DatetimeArray, overwritten by PeriodArray | ||
if is_object_dtype(dtype): | ||
return np.array(list(self), dtype=object) | ||
|
@@ -383,7 +383,7 @@ def astype(self, dtype, copy=True): | |
else: | ||
return np.asarray(self, dtype=dtype) | ||
|
||
def view(self, dtype=None): | ||
def view(self, dtype: Optional[Dtype] = None): | ||
if dtype is None or dtype is self.dtype: | ||
return type(self)(self._ndarray, dtype=self.dtype) | ||
return self._ndarray.view(dtype=dtype) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
these should be NpDtype (this is a numpy protocol)