repl.it
@tml/

BrilliantTangibleArchives

Python

No description

fork
loading
Files
  • main.py
  • newjson.json
  • testfile.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import json
import pandas

with open("newjson.json", 'r') as file:
	data = json.load(file)

with open("testfile.txt", "w") as damn:
	for key, value in data['result']['totals']['requests']['country'].items():
		print("{}, {}".format(key, value), file = damn)

df = pandas.read_csv("testfile.txt", header = None, names = ["Cnty", "Counts"])
df.sort_values(by=['Counts'], inplace=True, ascending=False)

print(df.reset_index(drop=True))