我有一个json
文件,我正在尝试将其读入Pandas。该文件如下所示:
{"0": {"a": 0, "b": "some_text", "c": "other_text"},
"1": {"a": 1, "b": "some_text1", "c": "other_text1"},
"2": {"a": 2, "b": "some_text2", "c": "other_text2"}}
当我这样做时:
df = pd.read_json("my_file.json")
df = df.transpose()
df.head()
我知道:
a b c
0 0 some_text other_text
1 1 some_text1 other_text1
10 10 some_text2 other_text2
因此,数据框的索引和列a
在此过程中被弄乱了。我在做什么错?
谢谢!