Python Forum
Read Nested JSON with pandas.io.json
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read Nested JSON with pandas.io.json
#3
(Apr-23-2019, 03:24 PM)gontajones Wrote: You can access only some columns of df using:
new_df = df[['Data.Code', 'Data.DateFrom', 'Data.Address']]

- But what about column Data.Address? There is lot of information in one column but not separetly. Instead of {'Street': 'Okružní', 'City': 'Sezimovo Ústí', 'PostCode': '39102'} I want only 2 separate columns Street and City

- And prefix of column is not only Data.xyz but for examlpe Data.snapshots.DateFrom or Data.snapshots.Address.Street etc.

- And it is not better use "df = pd_json.json_normalize" for reading and assigning to "df" only columns which I want, not all columns?

I think this part of code is necessary to modify, but I do not how

df = pd_json.json_normalize(fin, 
                        record_path=['Data','snapshots'],
                        record_prefix = 'Data.',
                        errors = 'ignore'
                        )
Reply


Messages In This Thread
Read Nested JSON with pandas.io.json - by palo173 - Apr-23-2019, 01:41 PM
RE: Read Nested JSON with pandas.io.json - by palo173 - Apr-24-2019, 05:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 2,985 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
  How to customize VS Code setting.json? NewPi 1 1,512 Dec-11-2022, 08:03 PM
Last Post: jefsummers
Smile How to further boost the data read write speed using pandas tjk9501 1 1,999 Nov-14-2022, 01:46 PM
Last Post: jefsummers
  Parse Nested JSON String in Python rwalde 4 5,128 Sep-08-2022, 10:32 AM
Last Post: rwalde
Information Parssing Json.dump from PYTHON to PHP for output on browser jodqueshiva 1 3,589 Nov-01-2021, 02:34 PM
Last Post: snippsat
  Write a dictionary with arrays as values into JSON format paul18fr 3 10,068 Oct-20-2021, 10:38 AM
Last Post: buran
  HELP! Importing json file into csv into jupyter notebook vilsef 2 3,400 Jan-22-2021, 11:06 AM
Last Post: snippsat
  Conversion CSV to JSON mati 1 2,556 Jan-09-2021, 08:19 PM
Last Post: jefsummers
  How to compare two json and write to third json differences with pandas and numpy onenessboy 0 6,017 Jul-24-2020, 01:56 PM
Last Post: onenessboy
  JSON file Loading issue punna111 4 10,362 Jun-29-2020, 08:07 AM
Last Post: buran

Forum Jump:

User Panel Messages

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