How to filter out Column data From Multiple rows data?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • firaki12345
    New Member
    • Jan 2021
    • 1

    How to filter out Column data From Multiple rows data?

    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:

    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)
    Attached Files
Working...