C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Pandas Series.map()The main task of map() is used to map the values from two series that have a common column. To map the two Series, the last column of the first Series should be the same as the index column of the second series, and the values should be unique. SyntaxSeries.map(arg, na_action=None) Parameters
ReturnsIt returns the Pandas Series with the same index as a caller. Exampleimport pandas as pd import numpy as np a = pd.Series(['Java', 'C', 'C++', np.nan]) a.map({'Java': 'Core'}) Output 0 Core 1 NaN 2 NaN 3 NaN dtype: object Example2import pandas as pd import numpy as np a = pd.Series(['Java', 'C', 'C++', np.nan]) a.map({'Java': 'Core'}) a.map('I like {}'.format, na_action='ignore') Output 0 I like Java 1 I like C 2 I like C++ 3 I like nan dtype: object Example3import pandas as pd import numpy as np a = pd.Series(['Java', 'C', 'C++', np.nan]) a.map({'Java': 'Core'}) a.map('I like {}'.format) a.map('I like {}'.format, na_action='ignore') Output 0 I like Java 1 I like C 2 I like C++ 3 NaN dtype: object
Next TopicPandas Series.std()
|