Typing: Narrow down types of arguments (Series)
Closed this issue · 2 comments
phofl commented
We prefer using Literal["a"] | Literal["b"]
instead of str
. Look into the documentation what is allowed and the narrow the types down appropriately. Generally, we probably already have type definitions in pandas/_typing.py
like NaPosition
for the first item in the list below.
You can locate the appropriate file through searching for class Series
in the repository.
Series methods:
- Specify
kind
andna_position
more precisely insort_values
(can look atsort_index
, it is already done there) - Specify
keep
fornsmallest
andnlargest
more precisely
mattkeanny commented
dong the second one