Python 到 pandas 数据框的字典缺少键值

Python dictionary to pandas dataframe missing key values

我在 windows 64 上使用 Python 3.8。

我使用 PyPDF2 来查找字符串。我使用以下代码将这些值定义到字典中:

keys=range(7)
values = (Docket, Date, CC, Owner, Scope, Crew, Additional)
dict_convert = dict(zip(keys,values))
print(dict_convert)

dict_convert 打印在下方并显示范围=7(键 0 到 6)

{0: '149623', 1: '21/10/19', 2: 'UTILITIES', 3: 'Camille .', 4: '008-lilyÞeld Rd-grove To Ryan-stop Slow-134-01, Rol_1268472_20190923-161408, ', 5: '5', 6: 'None'}

当我将其解析为 Pandas DataFrame 时,仅输出键 0 到 4。任何想法为什么?提前致谢。

df = pd.DataFrame.from_dict(dict_convert, orient='index',dtype=None)
print(df.head())

                                                   0
0                                             149623
1                                           21/10/19
2                                          UTILITIES
3                                          Camille .
4  008-lilyÞeld Rd-grove To Ryan-stop Slow-134-01...

因为如果使用 DataFrame.head 它会过滤前 5 行。

如果想查看小型 DataFrame 中的所有数据:

print(df)

如果有更多行并添加 ... 使用:

#temporaly display all rows
with pd.option_context('display.max_rows', -1):
    print (df)