What you have is pretty close to the best you can get, simply swap out each of the type hints for a pandas.core.series.Series
to get the correct type hints. Here is an example implementation modeled after your example.
import pandas as pd
import pandas.core.series
import io
class TypedDataFrame(pd.DataFrame):
day: pd.core.series.Series
country: pd.core.series.Series
weather: pd.core.series.Series
def _main():
df: TypedDataFrame = TypedDataFrame(pd.read_csv(io.StringIO(
'day,country,weather\n'
'1,"CAN","sunny"\n'
'2,"GBR","cloudy"\n'
'4,"IND","rain"'
)))
print(type(df.weather))
print(df.country[0])
if __name__ == '__main__':
_main()
And here are what the type hints looks like in Pycharm at least, I would expect VSCode or others to be similar: