I have a dataset that looks like this
43466   1323.507803
43467   1396.948621
43468   1481.437362
43469   1611.111671
43470   1379.217261
43471   1425.450351
I am trying to loop through the dataset with Python Pandas and set x and y axis for each day to look at the last 30, here I use a smaller set for shorter explanation - last 3 days
I have itertupled through the rows correctly but I am not sure why this is not working.
I am using
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
dataset = pd.read_csv('~/Desktop/test2.csv')
df = pd.DataFrame(dataset)
for row in dataset.head(2).itertuples():
    #print(row.Date)
    print(dataset.loc[dataset["Date"]==row.Date].tail(5)) 
What I currently get is:
  Date  Usage
0  43466.0   1323.507803
  Date  Usage
1  43467.0   1396.948621
If I loop through the row - I am expecting each print out to start where the date is == to the row.Date being looped. The final print should look like this
row index 0 print
43466   1323.507803
row index 1 print
43466   1323.507803
43467   1396.948621
row index 2 print
43466   1323.507803
43467   1396.948621
43468   1481.437362
. . . . . all the way to row index 5 print
43466   1323.507803
43467   1396.948621
43468   1481.437362
43469   1611.111671
43470   1379.217261
43471   1425.450351
