I want to filter a json file from pool.pm
For example, https://pool.pm/wallet/$1111 and I want to get all the "policy"’s and how many time it repeats and organize it on a excel using openpyxl and in the first column the policies and in the 2nd column how many time it repeats
What I have:
import openpyxl
import json
import requests
from bs4 import BeautifulSoup
pooladd = str(input("Insira o address:t"))
api_pool = "https://pool.pm/wallet/{}"
api_pool2 = api_pool.format(pooladd)
data = requests.get(api_pool2).json()
Output:
Policy | How Many |
---|---|
f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a | 10 |
8728079879ce4304fd305b12878e0fcea3b8a3a5435a21b5dec35a11 | 3 |
2
Answers
I don’t see pandas tag but in case you’re interested, here is an approach with
value_counts
:If you wanna make an Excel spreadsheet, use
pandas.DataFrame.to_excel
:# Output :
another implementation!, comments are added to the code.
Build the dictionary and then write the excel.