I am having trouble reading csv file and making a histogram using pyroot.
Here’s my code:
1 import ROOT
2 import csv
3 import array
4 import numpy
5 #canvas = ROOT.TCanvas("canvas", "canvas title", 800, 600)
6
7 infilename = 'prac_data.csv'
8
9 hist = ROOT.TH1F("variable", "Title; xaxis; yaxis", 4, 105, 125)
10
11 with open(infilename, 'r') as csvfile:
12 reader = csv.reader(csvfile)
13 for i in reader:
14 hist.Fill(i)
15
16 hist.Draw()
This is the error message I am getting.
Also, when I print entries from the file, the output is in this format.