I have a function that return some values:
def sigInput(audio):
...
...
...
return [mean, total, power]
data1 = sigInput('sound1.wav')
data2 = sigInput('sound2.wav')
data3 = sigInput('sound3.wav')
data4 = sigInput('sound4.wav')
df = pd.DataFrame({
'mean': [data1[0], data2[0], data3[0], data4[0]],
'total': [data1[1], data2[1], data3[1], data4[1]],
'power': [data1[2], data2[2], data3[2], data4[2]],
'label': ['data1', 'data2', 'data3', 'data4']
})
df.to_excel('expData.xlsx')
Based on the code above, data1, data2, data3, and data4 will have three values according to what the function returns. My target is I want to export these data to excel using pandas.
If I have more than four data, maybe 10 or 20 data, then I have to write the DataFrame manually.
My question is how to make the contents in the pd.DataFrame more dynamic if it has a lot of data?
Thank you for the help