我收到了这个已弃用警告:
Using short name for 'orient' is deprecated. Only the options: ('dict', list, 'series', 'split', 'records', 'index') will be used in a future version. Use one of the above to silence this warning.
当使用这些行时:
df.to_dict('records')
df.to_dict(orient='records')
df.to_dict(orientation='records')
pandas v1.1.3 python v3.7.1
'records'
不会触发此警告。另外,我想知道为什么orientation=...
在这里是一个有效的关键字参数。在不运行代码的情况下,我预计你的第三行会出错。 - Niklas Mertschorientation
抛出一个错误,'records'
和orient='records'
正常工作,'orient='r''
引起了所描述的警告并且也正常工作。 - Niklas Mertsch