-
Notifications
You must be signed in to change notification settings - Fork 1k
Operator "-" not supported for types "DataFrame" and "Series[Dtype@mean] #2139
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingtypestubIssue relating to our bundled type stubsIssue relating to our bundled type stubs
Description
- Language Server version: v2021.11.2
- OS and version: macOS 10.15.7
- Python version: 3.8.2
Actual behaviour
import numpy as np
import pandas as pd
columns = ['A']
df = pd.DataFrame(np.random.randint(0, 100, size=(100, 1)), columns=columns)
# Normalization
df = (df - df.mean()) / df.std()
Operator "-" not supported for types "DataFrame" and "Series[Dtype@mean]"
Operator "-" not supported for types "DataFrame" and "Series[Dtype@mean]"
PylancereportGeneralTypeIssues
# Denormalization
epsilon = 1e-100
coefficients = pd.DataFrame()
coefficients['mean'] = df.loc[:, columns].mean()
coefficients['std'] = df.loc[:, columns].std() + epsilon
coefficients = coefficients.T
column = 'A'
std = coefficients.loc['std', column]
mean = coefficients.loc['mean', column]
df[column] = X[column] * std + mean
Operator "*" not supported for types "Series[Dtype@__getitem__]" and "Scalar"
PylancereportGeneralTypeIssues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtypestubIssue relating to our bundled type stubsIssue relating to our bundled type stubs