3

Using VSCode with Pylance, creating a basic series with pandas shown here will show an error. I looked around online and this question hasn't been asked yet, so I'm assuming I have some basic setup done incorrectly.

Using conda, python@3.8.3, pandas@1.4.4

enter image description here

import pandas as pd

test_series = pd.Series([1, 3, 5, 6, 7, 8])
(variable) test_series: Series[Unknown]
Type of "test_series" is partially unknown
  Type of "test_series" is "Series[Unknown]"PylancereportUnknownVariableType
Farris Ismati
  • 176
  • 1
  • 9

1 Answers1

0

It's an embarrassingly lame answer, but this will kill the warnings:

from typing import List
import pandas as pd

lst: List[int] = [1, 3, 5, 6, 7, 8]
test_series: pd.Series[int] = pd.Series(lst)

[I came here looking for a similar answer, so you are not along struggling with Python types and Pandas.]

watusimoto
  • 63
  • 1
  • 1
  • 5