I have a list of data which is then converted into pandas Data Frame and added to csv file. The only problem is that I cannot find a way to name columns in that csv. Here is a piece of code that loads the data into a .csv
def on_message(ws, message):
print('Otrzymano wiadomość')
print(message)
json_message = json.loads(message)#Decoding json
price_data = [json_message["data"]["o"]]
price_data.append(json_message["data"]["c"])
price_data.append(json_message["data"]["h"])
price_data.append(json_message["data"]["l"])
time_stamp = dt.datetime.now()
time_stamp = time_stamp.strftime('%Y-%m-%d %H:%M:%S')
col = [time_stamp]
col.extend(price_data)
df = pd.DataFrame(col)
df = df.T
df.to_csv(str(time_stamp[0:11]) + 'stockdata.csv', mode = 'a', header = False)
print(df)