Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import numpy as np
- df = pd.DataFrame({'uno': [1, 2, 3], 'dos': [4, 5, 6], 'tres': [7, 8, 9]}, index=['x', 'y', 'z'])
- # Eleva al cuadrado todos los elementos:
- print(df.applymap(lambda x: x*x))
- print()
- # Triplica los elementos de la columna 'dos':
- print(df['dos'].map(lambda x: 3 * x))
Add Comment
Please, Sign In to add comment