0

enter image description here

from sklearn.preprocessing import PowerTransformer
pt = PowerTransformer(method='yeo-johnson',standardize=True)

X_train['feature']=pt.fit_transform(np.array(X_train['feature']).reshape(-1, 1))

#fit the model only on the train set and transform the test set
X_test['feature']=pt.transform(np.array(X_test['feature']).reshape(-1, 1))

getting below error

AttributeError: module 'numpy' has no attribute 'warnings'

Akash Kumar
  • 137
  • 2
  • 8

1 Answers1

2

working fine with numpy==1.23.4

giving error with numpy==1.24.0

Akash Kumar
  • 137
  • 2
  • 8
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 23 '22 at 12:35
  • 1
    Anyone coming here can run: pip install numpy==1.23.4 until the latest is fixed. – kaminsknator Feb 17 '23 at 18:37
  • 1
    I don't think it's going to be fixed. `numpy.warnings` was just an alias for the builtin `warnings` and it's been removed from the `numpy` namespace. Turns out we should have just been using the builtin all along! https://github.com/numpy/numpy/commit/118e6c433a9afdefbfad7652f56e2b97e23bc508 – jon_two May 05 '23 at 10:58
  • 2
    Anyone coming here can add `import numpy, warnings` and `numpy.warnings = warnings` to the top of their main script. As a workaround of course. – SomethingSomething May 15 '23 at 11:47