熊猫已弃用警告to_dict

问题描述

我收到此已弃用的警告:

Error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

使用以下任何一条线时:

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.

pandas v1.1.3 python v3.7.1

解决方法

警告说“ orient”已被弃用。像这样使用它:

df.to_dict('records')

不要直接使用orient='',而要使用('dict',list,'series','split','records','index'),例如:

df.to_dict('dict')

df.to_dict('list')

,

我对同一警告感到困惑。后来我发现我使用“记录”而不是“记录”。无论如何,您都可以在警告之前1485附近的行中,在文件“ pandas / core / frame.py”中插入print(orient)行。