In [16]:
import pandas as pd
df = pd.read_csv('Count by vehicles[Bar]].tsv', sep='\t')
In [17]:
df.columns
Out[17]:
In [20]:
with open('outfile_vehicle.txt', 'w') as f:
f.write('[\n')
for i in range(df.shape[0]):
data_to_write = "{\"count_sum\": %s, \"Vehicle\": \"%s\", \"group\" : \"%s\"}" % (int(df['count_sum'][i]), df['Vehicles'][i], df['Vehicles'][i])
f.write(data_to_write + ',\n')
f.write(']\n')
f.close()
In [ ]: