Python Forum
How to filter out Column data From Multiple rows data?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to filter out Column data From Multiple rows data?
#1
Good Evening


Hi everyone, so i got the following JSON file from Walmart regarding their product items and price.


so i loaded up jupyter notebook, imported pandas and then loaded it into a Data frame with custom columns as shown in the pics below.


[Image: walmart1.png]

[Image: walmart2.png]


now this is what i want to do:

make new columns named as min price and max price and load the data into it

how can i do that ?


Here is the code in jupyter notebook for reference.

i also want the offer price as some items don't have minprice and maxprice :)


EDIT: Here is the code and Json file

Json File: https://pastebin.com/sLGCFCDC


Python Code:

import json
import pandas as pd
     
     
with open("walmart.json") as f:
 data = json.load(f)
     
walmart = data["items"]
     
     
wdf = pd.DataFrame(walmart,columns=["productId","primaryOffer"])
     
     
print(wdf.loc[0,"primaryOffer"])
     
     
pd.set_option('display.max_colwidth', None)
     
print(wdf)
Reply


Messages In This Thread
How to filter out Column data From Multiple rows data? - by firaki12345 - Jan-31-2021, 02:11 PM

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 528 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  Filter data into new dataframe as main dataframe is being populated cubangt 8 1,116 Oct-23-2023, 12:43 AM
Last Post: cubangt
  Returning Column and Row Data From Spreadsheet knight2000 0 490 Oct-22-2023, 07:07 AM
Last Post: knight2000
  how do you style data frame that has empty rows. gsaray101 0 559 Sep-08-2023, 05:20 PM
Last Post: gsaray101
  Database that can compress a column, or all data, automatically? Calab 3 1,280 May-22-2023, 03:25 AM
Last Post: Calab
  Code for pullng all data in a column EmBeck87 5 1,196 Apr-03-2023, 03:43 PM
Last Post: deanhystad
  (Python) Pulling data from UA Google Analytics with more than 100k rows into csv. Stockers 0 1,292 Dec-19-2022, 11:11 PM
Last Post: Stockers
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 2,005 Dec-12-2022, 08:22 PM
Last Post: jh67
  Write sql data or CSV Data into parquet file mg24 2 2,530 Sep-26-2022, 08:21 AM
Last Post: ibreeden
  How to assign a value to pandas dataframe column rows based on a condition klllmmm 0 888 Sep-08-2022, 06:32 AM
Last Post: klllmmm

Forum Jump:

User Panel Messages

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