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'])
- # Iteración por columnas del DataFrame:
- for col in df:
- print(df[col].mean())
- print()
- # Iteración por filas del DataFrame:
- for indice_fila, fila in df.iterrows():
- print(indice_fila)
- print(fila)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement