Skip to content

Commit e5e4be9

Browse files
Fixed _get_item for Series (#50)
1 parent 64f2be6 commit e5e4be9

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def list_packages(source_path: str = src_path) -> None:
2121
setup(
2222
name="pandas-stubs",
2323
package_dir={"": src_path},
24-
version="1.1.0.8",
24+
version="1.1.0.9",
2525
description="Type annotations for Pandas",
2626
long_description=(open("README.md").read()
2727
if os.path.exists("README.md") else ""),

tests/snippets/test_series.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import tempfile
44
from pathlib import Path
5+
from typing import List
56

67
import pandas as pd
78
import numpy as np
@@ -406,3 +407,10 @@ def test_types_resample() -> None:
406407
s.resample('3T').sum()
407408
# origin and offset params added in 1.1.0 https://pandas.pydata.org/docs/whatsnew/v1.1.0.html
408409
s.resample('20min', origin='epoch', offset=pd.Timedelta(value=2, unit='minutes'))
410+
411+
412+
def test_types_getitem() -> None:
413+
s = pd.Series({'key': [0, 1, 2, 3]})
414+
key: List[int] = s['key']
415+
s2 = pd.Series([0, 1, 2, 3])
416+
value: int = s2[0]

third_party/3/pandas/core/series.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
4747
def __init__(self, data: Optional[Any] = ..., index: Optional[Any] = ..., dtype: Optional[Dtype] = ..., name: Optional[Any] = ..., copy: bool = ..., fastpath: bool = ...) -> None: ...
4848
def __len__(self) -> int: ...
4949
@overload
50-
def __getitem__(self, key: Label) -> Scalar: ...
50+
def __getitem__(self, key: Label) -> Any: ...
5151
@overload
5252
def __getitem__(self, key: slice) -> DataFrame: ...
5353
def __setitem__(self, key: Label, value: Scalar) -> None: ...

0 commit comments

Comments
 (0)