File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ the following example that creates two series of datetimes with corresponding ar
3737
3838``` python
3939import pandas as pd
40+ from typing import reveal_type
4041
4142s1 = pd.Series(pd.to_datetime([" 2022-05-01" , " 2022-06-01" ]))
4243reveal_type(s1)
@@ -51,14 +52,14 @@ reveal_type(ssum)
5152The above code (without the ` reveal_type() ` statements) will get a ` Never `
5253on the computation of ` ssum ` because it is
5354inappropriate to add two series containing ` Timestamp ` values. The types will be
54- revealed as follows:
55+ revealed by ` mypy ` as follows:
5556
5657``` text
57- ttest.py:4 : note: Revealed type is "pandas.core.series.Series[pandas._libs.tslibs.timestamps.Timestamp]"
58- ttest.py:6 : note: Revealed type is "pandas.core.series.Series[pandas._libs.tslibs.timestamps.Timestamp]"
59- ttest.py:8 : note: Revealed type is "pandas.core.series.TimedeltaSeries"
60- ttest.py:9 : error: Need type annotation for "ssum" [var-annotated]
61- ttest.py:10 : note: Revealed type is "Never"
58+ ttest.py:5 : note: Revealed type is "pandas.core.series.Series[pandas._libs.tslibs.timestamps.Timestamp]"
59+ ttest.py:7 : note: Revealed type is "pandas.core.series.Series[pandas._libs.tslibs.timestamps.Timestamp]"
60+ ttest.py:9 : note: Revealed type is "pandas.core.series.TimedeltaSeries"
61+ ttest.py:10 : error: Need type annotation for "ssum" [var-annotated]
62+ ttest.py:11 : note: Revealed type is "Never"
6263```
6364
6465The type ` Series[Timestamp] ` is the result of creating a series from ` pd.to_datetime() ` , while
You can’t perform that action at this time.
0 commit comments