how to use lambda function in pandas code example
Example 1: lambda in pandas
Series.apply(lambda x: x**2)
#x represent the cell value and x**2 is your function
Example 2: df = df.apply(lambda x: np.square(x) if x.name in [ 'a', 'e', 'g'] else x, axis=1)
import numpy as np # optional
import pandas as pd
print(pd.__version__)
print(pd.show_versions(as_json=True))