关于 pandas.read_csv 的 float_precision 参数

On the float_precision argument to pandas.read_csv

此 post 标题中参数的 documentation 说:

float_precision : string, default None

Specifies which converter the C engine should use for floating-point values. The options are None for the ordinary converter, high for the high-precision converter, and round_trip for the round-trip converter.

我想详细了解提到的三种算法,最好不要深入研究源代码1.


问: 这些算法是否有名称,我可以Google 准确了解它们的作用和不同之处?


(还有一个问题:在这种情况下,“C 引擎”到底是什么?那是 Pandas-specific 还是 Python-wide?None以上?)


1 不熟悉有问题的代码库,我预计我需要很长时间才能 locate相关源代码。但即使假设我设法找到它,我对这种算法的经验是它们的实现是如此高度优化,并且在如此低的水平上,如果没有一些 high-level 描述,它真的很难,至少对我而言, 关注最新动态。

您询问了实际算法 - 我能找到的最接近的是: https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/parsers.pyx#L492

本文摘自相关回答,感谢MaxU ()

Ordinary: double_converter_nogil = xstrtod
High: double_converter_nogil = precise_xstrtod
Round-Trip: double_converter_withgil = round_trip

从这里开始,您就在 C 地。您还问为什么 pandas 使用 C - 关键代码路径是用 Cython 或 C 编写的。