2013-08-28 11 views

risposta

11

sufficiente utilizzare il sys.stdin come file oggetto (che è in realtà) e passarlo a pandasread_xy metodo.

$ cat test.py 
import sys 
import pandas as pd 

df = pd.read_json(sys.stdin) 
print df 

$ cat data.json 
{"a": [1,2,3,4], "b":[3,4,5,6]} 

$ python test.py < data.json 
    a b 
0 1 3 
1 2 4 
2 3 5 
3 4 6 
Problemi correlati