import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as plt
from ast import literal_eval
import json
%matplotlib inline
with open('today.json') as f:
data = literal_eval(f.read())
df = pd.DataFrame(data)
print(df)
错误:
File "<ipython-input-16-6c3ee58610d7>", line 10
data = literal_eval(f.read())
^
IndentationError: expected an indented block
答案 0 :(得分:0)
pd.read_json()
是您所需要的:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_json.html
您只需使用df = pd.read_json('today.json')