I have designed code as:
import csv
import numpy as np
data = [['Diameter', 'color', 'no']]
with open('samp1.csv', 'w') as f:
writer = csv.writer(f, delimiter=',')
for row in data:
writer.writerow(row)
for i in np.arange(20,30,0.2):
writer.writerow(i)
f.close()
And I want to save numbers from 20-30 with an increment of 0.2 in the diameter column, but it's giving errors and not even saving the CSV file. Can someone suggest any solution? Even there are various ranges for other columns too, so I need the same method to work for that code.
CSV example
diameter color number
20 2 3
20 2.5 3
20 3 3
20 3.5 3
20.2 2 3
20.2 2.5 3
20.2 3 3
20.2 3.5 3
.
.
.
.
22 2 4
22 2.5 4
22 3 4
22 3.5 4
22.2 2 4
22.2 2.5 4
22.2 3 4
22.2 3.5 4