You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we look at the most referenced partially unknown classes in pandas, we have:
Series
Index
DataFrame
ExtensionArray
InternalIndex
...
Many of these depend on each other:
Series.to_frame() returns DataFrame
DataFrame.__getitem__ returns a union including Series
Index.to_series() returns Series
IntervalIndex.__ge__ returns Series
ExtensionArray.to_numpy() has a parameter na_type, whose type includes Union["Period", "Timestamp", "Timedelta", "Interval"]
Period.__sub__ returns Series
Series.groupby uses IntervalIndex, PeriodIndex, and others in overloads, so those need typing as a precursor to Series appearing as typed
Completed:
ExtensionArray [done!]
My plan for now is to make sure everything in ExtensionArray is typed. What's missing:
astype
why do other different astype methods type dtype differently? There's: AstypeArg, Dtype, and DtypeArg. DType is a dtype object, like Int64Dtype. DtypeArg is a mapping from str to DType. AstypeArg is anything that can be converted to a dtype
fillna
dropna
unique
repeat
why does upstream pandas use AxisInt?
make typealias for "arraylike of ints"
take
why does this use fill_value: Any whereas shift uses fill_value: object?
view
overloads based on dtype
ravel
make order typealias
tolist: return value is partially unknown (just list)
searchsorted. requires overloads
why does pd.Index use _ListLike? check divergence, check if mapping is really valid here
DatetimeIndex
__reduce__ (can probably be removed?)
snap
slice_indexer (can probably be removed, just use the parent method?)
indexer_at_time
indexer_between_time
BaseGroupBy
get_group
RangeIndex
RangeIndex
max
min
from_range
__reduce__
get_indexer
tolist
argsort
factorize
equals
join
__floordiv__
IntervalIndex
get_indexer
CategoricalIndex
__new__
how to type "index-like"?
equals (just inherit)
values
__contains__
unique
reindex
type in base class
get_indexer
get_indexer_non_unique
delete
type in parent class
insert
type in parent class
Series
Series
view
array_ufunc
__setitem__
combine what's in _LocIndexer.__setitem__ and _ILocIndexer.__setitem__?
mode
first
last
where
just missing other
set_axis
just missing labels. can probably the same as the data annotation in Index?
DataFrame
__new__
__dataframe__ (but this should probably be deprecated so perhaps hold off on this one for now)
__rmatmul__
__setitem__ (same trick as for Series.__setitem__)
pivot_table
which aggfunc to use? it's documented to be function, list of functions, dict, default "mean", and type aliases are:
AggFuncTypeBase: function
AggFuncTypeDictSeries: {col_name: function}
AggFuncTypeDictFrame: {col_name: function | list[function]}
If we look at the most referenced partially unknown classes in pandas, we have:
Many of these depend on each other:
DataFrame.__getitem__returns a union includingSeriesIntervalIndex.__ge__returns SeriesExtensionArray.to_numpy()has a parameterna_type, whose type includesUnion["Period", "Timestamp", "Timedelta", "Interval"]Period.__sub__returnsSeriesSeries.groupbyusesIntervalIndex,PeriodIndex, and others in overloads, so those need typing as a precursor toSeriesappearing as typedCompleted:
ExtensionArray [done!]
My plan for now is to make sure everything in
ExtensionArrayis typed. What's missing:astypeastypemethods typedtypedifferently? There's:AstypeArg,Dtype, andDtypeArg.DTypeis a dtype object, likeInt64Dtype.DtypeArgis a mapping from str toDType.AstypeArgis anything that can be converted to a dtypefillnadropnauniquerepeatAxisInt?takefill_value: Anywhereasshiftusesfill_value: object?viewravelordertypealiastolist: return value is partially unknown (justlist)pd.Indexuse_ListLike? check divergence, check if mapping is really valid hereDatetimeIndex
__reduce__(can probably be removed?)BaseGroupBy
RangeIndex
RangeIndex
__reduce____floordiv__IntervalIndex
CategoricalIndex
__new____contains__Series
Series
__setitem___LocIndexer.__setitem__and_ILocIndexer.__setitem__?otherlabels. can probably the same as thedataannotation inIndex?DataFrame
__new____dataframe__(but this should probably be deprecated so perhaps hold off on this one for now)__rmatmul____setitem__(same trick as forSeries.__setitem__)pivot_tablefunction, list of functions, dict, default "mean", and type aliases are:histboxplot(frustratingly complicated overloads)radd,rsub,eq,gt,lt,le,lt,rdiv,rfloordiv,rmod,rmul,rpow,rtruediv(potentially frustrating)asofasfreqfirst(deprecated)last(deprecated)set_axiswhere(align with Series once that's merged)Index
Index:
__array_wrap____copy__to_flat_indexto_frameset_namesdrop_level__reduce__isnanotnafillnamemory_usage__setitem__putmaskidenticalasofasof_locssort_valuesget_indexer_non_uniqueget_indexer_formapisin(do this separately)slice_indexerget_slice_boundslice_locsIn progress
IntegerArray / BaseMaskedArray: simple-ish but doesn't move metric