I have a list of two numpy arrays that look like these:
a_b = [array([0.23078484, 0.23076418]),
array([0.3478484, 0.72076418]),
array([1.42590463, 1.42562456])]
c_d = [array([0.23276474, 0.23276488]),
array([0.3498484, 0.72086418]),
array([1.43590464, 1.44562477])]
and I want to generate a csv file that looks like the following
Source A B C
a_b 0.23078484 0.3478484 1.42590463
a_b 0.23076418 0.72076418 1.42562456
c_d 0.23276474 0.3498484 1.43590464
c_d 0.23276488 0.72086418 1.44562477
I have tried this so far
df = pd.DataFrame({'a_b': a_b , 'c_d': c_d}, columns = ['A', 'B','C'])
df.to_csv('test.csv', index=False)
But it gives this error
raise ValueError("All arrays must be of the same length")
ValueError: All arrays must be of the same length