
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 Whereas json module allows you to convert the python data types formats to JSON format. This post will list the most used methods to convert CSV to JSON string using Python: Method 1: Using df.tojson () Function. Read the lines of CSV file using csv.DictReader() function. To make it easier to work with data, the CSV file is converted into JSON using different methods in Python. This will help us to make use of python dict methods to perform some operations. To convert CSV to JSON in Python, follow these steps: Initialize a Python List.


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 csv module allows you to read a CSV file or write CSV data to a file. The first step is to read the JSON file as a python dict object.
