
So, here I did got my answer but instead of printing it once, It is printing 7 times. Output userID,Is salary credited before 5th,Avg Salary of last 3 months,Avg Salary of last 6 months,Avg Balance before salary of last 3 months,Avg Balance before salary of last 6 monthsĦ79d3bad-155e-4b39-9ff7-7d564f408942,Yes,15453.33,15290.5,113.15,105.22 format() to convert a float into dollars and cents left justified in python Convert nested JSON to CSV in Python Convert json list into dictionary in python Python - Convert JSON object data into a List How to convert large xml file into csv using Python.

That's okay, if its what you need, but that means that for each document you want in your output, you'll have to call json.dumps. We will convert the CSV file into a JSON file with the help of a simple Python program as scripted below. Python and ElasticSearch: Convert CSV to JSON with index format a string using. Following is my json file input Ĭode with open('/Users/vrindabv/Documents/PycharmProjects/BankStatementEngine/test.json', "r") as f:į = csv.writer(open("/Users/vrindabv/Documents/PycharmProjects/BankStatementEngine/test.csv", "w"))į.writerow()į.writerow(, x, The problem with your desired output is that it is not valid json document, it's a stream of json documents. Step 1: Take input the CSV file and the JSON file paths This can be achieved with the help of the input function.
