How to specify the type of pandas series elements in type hints?

后端 未结 2 1794
滥情空心
滥情空心 2021-02-20 01:04

My function returns a pandas series, where all elements have a specific type (say str). The following MWE should give an impression:

import pandas as         


        
2条回答
  •  遥遥无期
    2021-02-20 01:44

    You can specify using dtype parameter

    pd.Series(data, dtype=str) for more information click here

提交回复
热议问题