I am writing a simple function in the context of machine learing
def build_model(X:pd.DataFrame, y:pd.Series):
...
return model
I'd love to make it explicit that this is a binary classifier by type-hinting y
as
def build_model(X:pd.DataFrame, y:pd.Series[bool]):
...
return model
But this results in an error:
TypeError: 'type' object is not subscriptable
Any ideas?
I could define my own type:
eg.
class BooleanSeries(pd.Series):
...
Or just use a string to represent the type...