Closed
Description
import pandas as pd
a = pd.Series([1, 2, 3, 4])
b = pd.Series(["even", "odd", "even", "odd"], dtype="category")
c = pd.Series(["even", "odd", "even", "odd"])
print("-- map by category")
try:
print(a.map(b))
except AttributeError as e:
print(e)
print("-- map by string")
print(a.map(c))
has the following output:
-- map by category
'Categorical' object has no attribute 'flags'
-- map by string
0 odd
1 even
2 odd
3 NaN
dtype: object