0

I am looking at the Init signature of pd.Series. It is as follows:

pd.Series(
    data=None,
    index=None,
    dtype: 'Dtype | None' = None,
    name=None,
    copy: 'bool' = False,
    fastpath: 'bool' = False,
)

Please could somebody explain why it says dtype: 'Dtype | None' = None and not simply dtype = None.

logi-kal
  • 7,107
  • 6
  • 31
  • 43
user615536
  • 109
  • 1
  • 1
  • 5
  • 1
    Does this answer your question? [What are type hints in Python 3.5?](https://stackoverflow.com/questions/32557920/what-are-type-hints-in-python-3-5) Specifically, see [this](https://stackoverflow.com/a/38045620/3000206) answer. – Carcigenicate Aug 12 '21 at 14:24
  • On top of that, `|` is the new symbol for `typing.Union`. That type hint would also be written as `typing.Optional[Dtype]`. – Carcigenicate Aug 12 '21 at 14:24

0 Answers0