My function returns a pandas series, where all elements have a specific type (say str). The following MWE should give an impression:
str
import pandas as
Unfortunately Python's type hinting does not support this out of the shelf. Nonetheless, you can always make use of dataenforce library (link) to add hints or even enforce validation.
dataenforce
You can specify using dtype parameter
pd.Series(data, dtype=str) for more information click here
pd.Series(data, dtype=str)