将单列的内容分成多列?

Separate content the single column into multiple column?

我正在使用表格 python 将 pdf 文件转换为 table。在扫描表格时检测到这样的 table,但是像 table 这样的列在 while the actually image of table is as below picture_2

中如下所示

有没有什么方法可以用python把一列变成单独的列,就像第二张图一样。

您需要使用 str.split with expand=True。

示例:

>>> import pandas as pd
>>> df = pd.DataFrame([["Purchase Balance"],["138 303"]])
>>> df
                0
0  Purchase Balance
1           138 303

>>> df[0].str.split(" ", expand=True)
         0        1
0  Purchase  Balance
1       138      303