Пример #1
0
def get_property_inflation_values(start, end):

    collection = jsonstat.from_url('https://statbank.cso.ie/StatbankServices/StatbankServices.svc/jsonservice/responseinstance/HPM06', 'tttt.json')
    df = collection.dataset(0).to_data_frame()
    
    
    con = df['Type of Residential Property'] == 'Dublin - all residential properties'
    con1 = df['Month'] == start
    con2 = df.Statistic == 'Residential Property Price Index (Base Jan 2005 = 100)'
    s_dub = df[con & con1 & con2]['Value'].values[0]
    
    con = df['Type of Residential Property'] == 'National excluding Dublin - all residential properties'
    con1 = df['Month'] == start
    con2 = df.Statistic == 'Residential Property Price Index (Base Jan 2005 = 100)'
    s_out = df[con & con1 & con2]['Value'].values[0]
    
    
    con = df['Type of Residential Property'] == 'Dublin - all residential properties'
    con1 = df['Month'] == end
    con2 = df.Statistic == 'Residential Property Price Index (Base Jan 2005 = 100)'
    e_dub = df[con & con1 & con2]['Value'].values[0]
    
    con = df['Type of Residential Property'] == 'National excluding Dublin - all residential properties'
    con1 = df['Month'] == end
    con2 = df.Statistic == 'Residential Property Price Index (Base Jan 2005 = 100)'
    e_out = df[con & con1 & con2]['Value'].values[0]
    
    return s_dub, e_dub, s_out, e_out
Пример #2
0
def test(uri, filename):
    print("downloading data from '{}'".format(uri))

    # extract collection
    collection = jsonstat.from_url(uri, filename)
    print(collection)

    # extract dataset contained into collection
    ds = collection.dataset('nama_gdp_c')
    print(ds)

    # show some values
    v = ds.data(geo="IT", time="2011")
    print("IT gdp in 2011 was {}".format(v))
Пример #3
0
def test(uri, filename):
    # extract collection
    print("downloading data from '{}'".format(uri))
    collection = jsonstat.from_url(uri, filename)
    print(collection)

    # extract dataset contained into collection
    ds = collection.dataset(0)
    print(ds)

    # show some values
    v = ds.data(0)
    lcat = ds.idx_as_lcat(0)
    print("{} -> {}".format(lcat, v.value))
Пример #4
0
def test(uri, filename):
    print("downloading data from '{}'".format(uri))

    # extract collection
    collection = jsonstat.from_url(uri, filename)
    print(collection)

    # extract dataset contained into collection
    ds = collection.dataset('nama_gdp_c')
    print(ds)

    # show some values
    v = ds.data(geo="IT", time="2011")
    print("IT gdp in 2011 was {}".format(v))
Пример #5
0
def test(uri, filename):
    # extract collection
    print("downloading data from '{}'".format(uri))
    collection = jsonstat.from_url(uri, filename)
    print(collection)

    # extract dataset contained into collection
    ds = collection.dataset(0)
    print(ds)

    # show some values
    v = ds.data(0)
    lcat = ds.idx_as_lcat(0)
    print("{} -> {}".format(lcat, v.value))
Пример #6
0
def info(cache_dir, args):
    if len(args) == 0:
        args = ['http://json-stat.org/samples/oecd-canada-col.json']

    d = jsonstat.cache_dir(cache_dir)
    print("downloaded file(s) are stored into '{}'\n".format(d))
    for arg in args:

        if arg.startswith("http"):
            print("download '{}'".format(arg))
            o = jsonstat.from_url(arg)
        else:
            print("reading '{}'".format(arg))
            o = jsonstat.from_file(arg)

        print(o)
        if isinstance(o, jsonstat.JsonStatCollection):
            print("\nfirst dataset:\n")
            print(o.dataset(0))
Пример #7
0
def info(cache_dir, args):
    if len(args) == 0:
        args = ['http://json-stat.org/samples/oecd-canada-col.json']

    d = jsonstat.cache_dir(cache_dir)
    print("downloaded file(s) are stored into '{}'\n".format(d))
    for arg in args:

        if arg.startswith("http"):
            print("download '{}'".format(arg))
            o = jsonstat.from_url(arg)
        else:
            print("reading '{}'".format(arg))
            o = jsonstat.from_file(arg)

        print(o)
        if isinstance(o, jsonstat.JsonStatCollection):
            print("\nfirst dataset:\n")
            print(o.dataset(0))
Пример #8
0
import pandas as pd
import jsonstat
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

url = (
    'http://www.cso.ie/StatbankServices/StatbankServices.svc/jsonservice/responseinstance/TEM20'
)
r = requests.get(url)
json_data = r.json()
for key, value in json_data.items():
    print(key + ':', value)

print(json_data.keys())
data = jsonstat.from_url(url)
print(data)
mcar = data.dataset(0)
print(mcar)
df = mcar.to_data_frame()
print(df.head(10))
print(df.tail(10))
print(df.dtypes)
print(df.sort_values("Make and Model", ascending=False))
Car = df['Make and Model']
print(Car)
print(max(Car))
print(min(Car))
print(list(Car))
df1 = df['Make and Model'].value_counts()
print(df.shape)
Пример #9
0
import requests
import pandas as pd
import jsonstat
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
url = url = 'https://ws.cso.ie/public/api.restful/PxStat.Data.Cube_API.ReadDataset/TEM22/JSON-stat/1.0/'
collection = jsonstat.from_url(url)
#print(collection)
mcar = collection.dataset(0)
#print(mcar)
for d in mcar.dimensions():
    print(d)
#print(mcar.value)
#print(mcar.value(C02437V02947= "Ford"))
df = mcar.to_data_frame()
#print(df)
#print(df.head())
#print(df.dtypes)
Car = df['Car Make']
print(Car.head)
print()rint(max(Car))
print(min(Car))
print(list(Car))
finalcarList=np.unique(Car).tolist()
print(finalcarList)