Advertisement
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'])
- # Aplica la función promedio a todas las filas:
- print(df.apply(np.mean))
- # Apica la función promedio a todas las columnas:
- print(df.apply(np.mean, axis=1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement