473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to filter out Column data From Multiple rows data?

1 Bit
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.


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:

Expand|Select|Wrap|Line Numbers
  1. import json
  2. import pandas as pd
  3.  
  4.  
  5. with open("walmart.json") as f:
  6.     data = json.load(f)
  7.  
  8. walmart = data["items"]
  9.  
  10.  
  11. wdf = pd.DataFrame(walmart,columns=["productId","primaryOffer"])
  12.  
  13.  
  14. print(wdf.loc[0,"primaryOffer"])
  15.  
  16.  
  17. pd.set_option('display.max_colwidth', None)
  18.  
  19.  
  20. print(wdf)
Attached Images
File Type: jpg walmart1.jpg (106.4 KB, 39 views)
File Type: jpg walmart2.jpg (227.4 KB, 41 views)
Jan 31 '21 #1
0 1173

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: TJ | last post by:
I'd like to do this: ------------------ |------------- XX |------------- |------------- ------------------ This is a navigation header with an icon. Each row will have text.
1
by: Hennie7863 | last post by:
Hi i want to create a table as follows : if exists (select * from dbo.sysobjects where id = object_id(N'') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table GO Create table...
9
by: kencana | last post by:
Hi all, I am a new bie in SOAP and PHP.I got one question about the data retrieval. I am able to retrieve the data successfully from my database. this is my sql statement: select roadname from...
1
by: Sanjaylml | last post by:
I have a form through which, e-mail address of parties are showing through datasheet mode. Is their any way to club the data of multiple rows in one column? Like : ajaimathur@rediffmail.com...
4
by: samitasahu | last post by:
Hi, I m showing College Details in a table in jsp . I want to transpose the column data into rows in the table. How to do that in jsp coding.
1
by: boss1 | last post by:
i m having problem with inserting data into oracle db using php. i need to how to fetch fetch multiple row's data from a table in html form and insert into oracle db at a time. may be looping is...
3
by: banderson | last post by:
Hello all, I have a table "tblContacts" that holds my Contact Info. Because there can be multiple Contact Types for a Contact, I have a second table "tlnkContactTypes" in which there is a record for...
0
by: sasha3 | last post by:
From my C# code i execute following SP, to save the xml file into a table. I would like to save a row in my table for each ComponentModule element. <ComponentModules> <ComponentModule...
1
by: devkumarOO7 | last post by:
i have a table questions in which collumn qname has multiple rows question. i am trying to retrive by select qname from questions where qid=1; but i found only one row data. Give the solution how...
1
by: ankit2092 | last post by:
I wish to insert values multiple times in the same table using a jsp page(i.e. multiple rows at once).How should i go about doing it?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.