【发布时间】:2017-02-24 00:23:45
【问题描述】:
解析一个大型pdf文档后,我最终得到了python格式的字符串:
Company Name;(Code) at End of Month;Reason for Alteration No. of Shares;Bond Symbol, etc.; Value, etc.; after Alteration;Remarks
Shares;Shares
TANSEISHA CO.,LTD.;(9743)48,424,071;0
MEITEC CORPORATION;(9744)31,300,000;0
TKC Corporation;(9746)26,731,033;0
ASATSU-DK INC.;(9747);42,155,400;Exercise of Subscription Warrants;0;May 2013 Resolution based 1;0Shares
May 2013 Resolution based 2;0Shares
是否可以将其转换为熊猫数据框,如下所示,其中列由“;”分隔。因此,从字符串中查看上述部分,我的 df 应该如下所示:
Company Name (Code) at End of Month Reason for Alteration ....
Value,etc after Alteration Remarks Shares .....
作为另一个问题,我的行并不总是有相同数量的由“;”分隔的字符串,这意味着我需要找到一种方法来查看我的列(我不介意设置像具有 15 列的数据框然后删除那些我不需要的) 谢谢
【问题讨论】:
-
我投反对票!我无法弄清楚是什么逻辑让我们从文本到您显示的数据框。