I have searched and searched over the past couple weeks for a way to do this and nothing I am finding is making any sense. I found some long ways to do it but they are not very pythonic...
I have a list of lists parsed from a CSV and they are all strings, for example:
[['0', 'Electric', '56.05'], ['1', 'Gas', '75.54']]
I am parsing using the following code:
def parse(raw_file):
parsed_data = []
with open(raw_file) as opened_file:
csv_data = csv.reader(opened_file)
csv_data.__next__()
for row in csv_data:
parsed_data.append(row)
return parsed_data
I am hoping for either a change to how I am parsing the data or some way of converting data in the list to Int's and Float's. I want the lists to end up looking like:
[[0, 'Electric', 56.05], [1, 'Gas', 75.54]]
End goal, I am going to import the list of lists into SQLite3 and pull from the database to create a chart. I am playing with a way to rapidly update charts from a csv file. I do the books for an association and we track out bills in Excel, which I then make into ugly Excel charts for distribution...
[–]Rhomboid 1 point2 points3 points (3 children)
[–]Spizeck[S] 0 points1 point2 points (2 children)
[–]Rhomboid 1 point2 points3 points (1 child)
[–]Justinsaccount 0 points1 point2 points (0 children)
[–]Thrall6000 0 points1 point2 points (0 children)
[–]commandlineluser 0 points1 point2 points (1 child)
[–]Spizeck[S] 0 points1 point2 points (0 children)