Describe the bug
Pandas dataframe supports to use string as slice keys to do indexing
To Reproduce
pandas.DataFramedf.loc[label:label2]Expected behavior
There should be no errors
Screenshots or Code
import pandas as pd
df = pd.DataFrame({
'A':[1, 2, 3],
'B':[2, 3, 4]
}, index = ['a', 'b', 'c'])
df2 = df.loc['a': 'b']
There should be no errors, but the following error message shown
Index for slice operation must be an int value or "None"
"str" is incompatible with "int"
Cannot assign to "None"
VS Code extension or command-line
VS Code extension
Additional context
N/A
Which version of pandas are you using?
Are you using a type stub? If so, which one?
Never mind, I was able to repro the problem. Thanks for the bug report. This will be fixed in the next version of pyright.
@erictraut pandas 1.0.1
Thanks Eric 馃槃
This is now fixed in version 1.1.32, which I just published.
Most helpful comment
This is now fixed in version 1.1.32, which I just published.