So say I have a bunch of data that goes like this:
10-12-2014 3.45
10-12-2014 3.67
10-12-2014 4.0
10-12-2014 5.0
10-13-2014 6.0
10-13-2014 8.9
and so on.
I want to put this stuff into a Pandas dataframe in this sort of format:
10-12-2014 3.45 3.57 4.0 5.0
10-13-2014 6.0 8.9 etc etc
In order to do that, currently I just have something like this:
rows = cursor.fetchall()
df = pd.DataFrame(columns('Date', Val1', 'Val2', 'Val3', 'Val4'))
previous_date = 0
for row in rows:
if previous_date == 0:
df.
And that's where I'm stuck - I can't seem to find a method that just adds a date and one of the values to the column. I'm also not sure how to update old columns in future iterations, because I've really only been able to find examples of people just adding entire rows. Or is there a better way to do this?