Is there a method to create column names based on the input variables in a Dataframe? Currently I am manually adjusting the column names whenever I make a change to the input variable. It would benefit me to only do this step once.
An example would be:
data = []
data1 = [1, 2, 3]
data2 = [3, 4, 5]
data3 = [6, 'a', 12]
combined = [data1, data2, data3]
data.append = (combined)
df = pd.Dataframe(data, columns = combined)
Desired result:
data1 | data2 | data3 | |
---|---|---|---|
0 | 1 | 3 | 6 |
1 | 2 | 4 | a |
2 | 3 | 5 | 12 |