What is Pandas map() method
The map() method only works on a pandas series where the type of operation to be applied depends on the argument passed as a function, dictionary, or list. This method is generally used to map values from two series having one column the same.
Python3
# The code below illustrates how the # map method works on the Pandas series: # Importing pandas import pandas as pd # Series generation gfg_string = 'w3wiki' gfg_series = pd.Series( list (gfg_string)) print ( "Original series\n" + gfg_series.to_string(index = False , header = False ), end = '\n\n' ) # Using apply method for converting characters # present in the original series new_gfg_series = gfg_series. map ( str .upper) print ( "Transformed series:\n" + new_gfg_series.to_string(index = False , header = False ), end = '\n\n' ) |
Output:
Contact Us