You can use df.iterrows()
normally:
import pandas as pd import numpy as np # Assuming 'df' is your DataFrame # For demonstration, let's create a sample DataFrame dates = pd.date_range('2023-01-01', periods=5) data = np.random.randn(5, 2) df = pd.DataFrame(data, index=dates, columns=['A', 'B']) # Iterating over rows for index, row in df.iterrows(): print(f"Index: {index}, A: {row['A']}, B: {row['B']}")
Note that index
is a pd.Timestamp
.