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
fromtypingimportTypedDict, Optional, LiteralclassOverlapsDict(TypedDict):
id: intseq_id: intpr_order: intpos1: intseq: strpos2: intseq_len: intrepeat_info: float# exactly, should be np.nanrepeat_type: float# exactly, should be np.nanitem_type: Literal['overlap']
devmode: strupdate_time: str
we can use OverlapsDict to restrict dict parameters like
defmyfunc(a:OverlapsDict):
pass
but in a lot of Data Science senerios, we need this parameter to be a DataFrame with certain columns in certain dtypes. is it possible
to achieve a new type class TypedDataFrame which can be used as the following code?
classOverlapsDataFrame(TypedDataFrame):
id: intseq_id: intpr_order: intpos1: intseq: strpos2: intseq_len: intrepeat_info: float# exactly, should be np.nanrepeat_type: float# exactly, should be np.nanitem_type: Literal['overlap']
devmode: strupdate_time: str
and can restrict DataFrame parameters with the OverlapsDataFrame
defmyfunc2(a:OverlapsDataFrame):
pass
constraint is a must be a DataFrame and has columns of certain names with certain types defined by OverlapsDataFrame
Pitch
The text was updated successfully, but these errors were encountered:
Feature
We Know that mypy and typing now support
we can use
OverlapsDict
to restrict dict parameters likebut in a lot of Data Science senerios, we need this parameter to be a DataFrame with certain columns in certain dtypes. is it possible
to achieve a new type class
TypedDataFrame
which can be used as the following code?and can restrict DataFrame parameters with the
OverlapsDataFrame
constraint is
a
must be a DataFrame and has columns of certain names with certain types defined byOverlapsDataFrame
Pitch
The text was updated successfully, but these errors were encountered: