I am writing a bunch of data outputted by a for loop into a .csv file I created (below). Having done that, I want to organize it by adding rows and columns at specific locations. I want to use it to add titles for each row and column. How do I go with that? Most examples online do so on csv.reader not writer. I'm a bit confused.
#the rows and columns i'd like to add, but i also want to insert rows after row 7
row0 = ['GRA1_1']
row1 = ['','Config 1 - Identical','','','Config 2 - mirrored','','','Config 3 - rotated','']
column0 = ['Projection of gyro on plane + xy (orth: +z)','Projection of gyro on plane + xz (orth: +y)','Projection of gyro on plane + yz (orth: +x)','Projection of gyro on plane - xy (orth: -z)','Projection of gyro on plane - xz (orth: -y)','Projection of gyro on plane - yz (orth: -x)']
with open('/Users/path/gyro_config.csv', 'a', newline='') as f:
writer = csv.writer(f, delimiter=',')
writer.writerows(gyro_projections)
I also found this link and tried to implement it but it gave me this error:
AttributeError: 'list' object has no attribute 'shape'
https://www.geeksforgeeks.org/insert-row-at-given-position-in-pandas-dataframe/