pandas How to insert the column name of datafram into the mysql table as value instead of inserting it as field name

i have a datafram simplely like this:

import numpy as np
import pandas as pd
dataA = [["2005-1-20", "9:35", 5, 15, 5], ["2005-1-20", "9:40", 8, 6, 1], ["2005-1-20", "9:45", 7, 5, 6],
    ["2005-1-20","9:50", 4, 8, 3]]
df = pd.DataFrame(data = dataA, columns=["date", "min", "vala", "valb", "valc"])

df
 
        date    min   vala  valb  valc
0   2005-1-20   9:35    5   15    5
1   2005-1-20   9:40    8   6     1
2   2005-1-20   9:45    7   5     6
3   2005-1-20   9:50    4   8     3

there is a problem, this datafram (df) changes it’s columns name Every 5 minutes,

and i want to get columns name : date min vala valb valc ,insert into a mysql table as value , so how do i insert the column name to mysql table as value, not as a field name

i try below ,but it insert as field name

from sqlalchemy import create_engine
engine = create_engine('mysql+pymysql://root:[email protected]:3306/dbcon')
df.to_sql('tableA', engine,if_exists='replace', index=False)

Answer

Try

df = pd.DataFrame(np.vstack([df.columns, df]))

before you do df.to_sql(...)

taken from here conversion column names into first row