Python Forum
Load multiple Jason data in one Data Frame
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Load multiple Jason data in one Data Frame
#3
(Aug-12-2022, 09:11 AM)Larz60+ Wrote: Try:
import pandas as pd
import os
from pathlib import Path


jpath = Path('C://JsonFiles//')
filelist = [filename for filename in jpath.iterdir()
    if filename.is_file() and filename.suffix == '.json']

df = pd.DataFrame([pd.read_json(file, typ="series") for file in filelist])
print(df)


Thanks Larz, but it does not work what I am expecting. If you look at my json files and review my code, I am trying to load those into one single dataframe with correct column names (I have attached one more screen with the data frame columns). json_normalize function and meta columns are used to extract the data hierarchical data from the Json.

My code works fine but it does not load all the given file's data in DF , only loads last one. Kindly please help to twick my code so that all files loaded in one DF.

Attached Files

Thumbnail(s)
   
Reply


Messages In This Thread
RE: Load multiple Jason data in one Data Frame - by vijays3 - Aug-12-2022, 09:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 481 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  Load data in Oracle muzokh 0 295 Mar-08-2024, 11:19 PM
Last Post: muzokh
  Using pyodbc&pandas to load a Table data to df tester_V 3 864 Sep-09-2023, 08:55 PM
Last Post: tester_V
  how do you style data frame that has empty rows. gsaray101 0 548 Sep-08-2023, 05:20 PM
Last Post: gsaray101
  googletrans library to translate text language for using data frame is not running gcozba2023 0 1,263 Mar-06-2023, 09:50 AM
Last Post: gcozba2023
  Write sql data or CSV Data into parquet file mg24 2 2,491 Sep-26-2022, 08:21 AM
Last Post: ibreeden
  conditionals based on data frame mbrown009 1 925 Aug-12-2022, 08:18 AM
Last Post: Larz60+
  Issue in changing data format (2 bytes) into a 16 bit data. GiggsB 11 2,732 Jul-25-2022, 03:19 PM
Last Post: deanhystad
  Merging two Data Frame on a special case piku9290dgp 0 1,106 Mar-02-2022, 10:43 AM
Last Post: piku9290dgp
  OCR-Python from Multi TIFF to HOCR getting only Data from 1st Page of multiple TIFF JOE 0 2,192 Feb-18-2022, 03:18 PM
Last Post: JOE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020