Feb-13-2020, 02:37 AM
Thanks for the tip.
I tried the following and it works. Hopefully there's no redundant stuff here:
I tried the following and it works. Hopefully there's no redundant stuff here:
file_name = "techcruncher.csv" lines = (line for line in open(file_name)) list_line = (s.rstrip().split(",") for s in lines) cols = next(list_line) company_dicts = (dict(zip(cols,data)) for data in list_line) z = list(company_dicts) funding = ( int(item["raisedAmt"]) for item in z if item["round"] == 'a') x = list(funding) print(sum(x)/len(x))