Pandas: 如何将以数字格式编写的数字转换为以文本格式编写的数字?

Pandas: How can I convert numbers written in a digit format to be written in text format?

我有一个文件,我愿意在其中转换数据框列中的所有数字,例如(1,2 等)转换为(一,二等)。 这是我的数据框的样子:

name
a1printanddisplay.com
a1programador.com.br
a1web.com.br
a1weblink.com
a2 hosting
a2 hosting inc. iceland
a2 system international
a2 group llc

有人知道最快的方法吗?

您可以尝试两种方法。第一种方法涉及单独转换每个数字。例如,381 将变为 "three eight one"

另一种方法是使用位值上下文转换数字。例如,381 将变为 "three hundred eighty-one"

对于第一种方法,请参见: Is there a way to convert number words to Integers?

对于第二种方法,尝试 num2words: https://pypi.python.org/pypi/num2words