Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to read JSON file using python?

Description

To read JSON file and select particular row and column in python.

Process

  Import pandas library.

  Read the JSON file.

  Store it as data frame.

  Access the rows and columns of data frame using multi-axes indexing function.

Sample Code

#import libraries

import pandas as pd

#read the JSON file

Data=pd.read_json(‘/home/soft27/soft27/

Sathish/Pythonfiles/Employeedetails.json’)

#Create the data frame

df=pd.DataFrame(data)

print(df)

#access the rows and colums randomly

print(“Accessing data from its location”)

print(data.loc[[1,3,5],[‘Salary’,’Name’]])

Screenshots
read JSON file using python
access the rows and colums randomly