I′m trying to get familiar with the pandas package. As I'm trying to manipulate strings in a column I get following error:
Traceback (most recent call last):
File "C:/Python/Udemy/pandas/main.py", line 12, in <module>
print(df["name"].str.upper())
File "C:UserssaxalAppDataLocal
-minicondalibsite-packagespandascorestringsaccessor.py", line 101, in wrapper
return func(self, *args, **kwargs)
File "C:UserssaxalAppDataLocal
-minicondalibsite-packagespandascorestringsaccessor.py", line 2686, in upper
result = self._array._str_upper()
AttributeError: 'PandasArray' object has no attribute '_str_upper'
I already tried installing different versions of numpy and pandas without success. Currently installed pandas 1.2.0
and numpy 1.19.5
If I run the exact same code e. g. on repl.it it works perfectly fine.
Example Code:
import pandas as pd
names = ["first name", "second name", "third name"]
numbers = [1,2,3]
data = {
"name": names,
"number": numbers
}
df = pd.DataFrame(data)
print(df["name"].str.upper())
question from:
https://stackoverflow.com/questions/65640831/pandas-str-methods-not-working-attributeerror-pandasarray-object-has-no-attr 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…