Home » Pandas Series.map()

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.

Syntax

Parameters

  • arg: function, dict, or Series.
    It refers to the mapping correspondence.
  • na_action: {None, ‘ignore’}, Default value None. If ignore, it returns null values, without passing it to the mapping correspondence.

Returns

It returns the Pandas Series with the same index as a caller.

Example

Output

0      Core  1      NaN  2      NaN  3      NaN  dtype: object  

Example2

Output

0    I like Java  1       I like C  2     I like C++  3     I like nan  dtype: object  

Example3

Output

0    I like Java  1       I like C  2     I like C++  3            NaN  dtype: object  

You may also like