originally using openpyxl , .split() method separate arrays of data. still leaves formatting, of able pandas.
any great, !
edit: if knows tutorials pandas beginners great !
edit2:
ami tavory's answer throws error:
traceback (most recent call last): file "c:\users\david\desktop\python\coursera\computational finance\capm\scatter\jsonparser.py", line 7, in <module> data = json.load(open('eth_usd.txt')) file "c:\python27\lib\json\__init__.py", line 290, in load **kw) file "c:\python27\lib\json\__init__.py", line 338, in loads return _default_decoder.decode(s) file "c:\python27\lib\json\decoder.py", line 369, in decode raise valueerror(errmsg("extra data", s, end, len(s))) valueerror: data: line 1 column 13409 - line 1 column 13426 (char 13408 - 13425)
edit3: code:
# import json parser import json # , pandas import pandas pd # assuming data in stuff.txt data = json.load(open('eth_usd.txt')) #bpd.dataframe(data) [finished in 1.1s]
edit3: worked treat:
# import json parser import json # , pandas import pandas pd url = 'http://cryptocoincharts.info/fast/period.php?pair=eth-usdt&market=poloniex&time=alltime&resolution=1d' data = pd.read_json(url) data = pd.dataframe(data) data.to_csv('eth_usd_pandas.csv')
there several ways. based on format of text linked, here 1 think easiest:
# import json parser import json # , pandas import pandas pd # assuming data in stuff.txt data = json.load(open('stuff.txt')) pd.dataframe(data)
Comments
Post a Comment