Data Scraping with Pandas
Made a json file and scraped with pandas
'''Pandas is used to gather data sets through its DataFrames implementation'''
import pandas as pd
df = pd.read_json('files/games.json')
print(df)
print(df[['Game Name']])
print()
print(df[['Average Monthly Players']])
print()
print(df[['Developers']])
print(df[['Game Name','Developers']].to_string(index=False))
print(df.sort_values(by=['Average Monthly Players'], ascending=False))
print()
#sort the values in reverse order
print(df.sort_values(by=['Average Monthly Players']))
df = pd.read_json('files/games.json')
print(df[df.Metacritic > 87])
print(df[df.Metacritic == df.Metacritic.max()])
print()
print(df[df.Metacritic == df.Metacritic.min()])
import pandas as pd
#read csv and sort 'Duration' largest to smallest
df = pd.read_json('files/games.json').sort_values(by=['Metacritic'], ascending=False)
print("-----Top Scoring 2-----")
print(df.head(2))
print()
print()
print("-----Bottom Scoring 2-----")
print(df.tail(2))