我用这种格式保存了几年的数据,每个新年用一个空行隔开:
2014
#34 - Show Title
Ensemble: ActorFirst1 ActorLast1, ActorFirst2 ActorLast2, ActorFirst3 ActorLast3, ActorFirst4 ActorLast4, ActorFirst5 ActorLast5, ActorFirst6 ActorLast6, and ActorFirst7 ActorLast7
Director: DirectorFirst1 DirectorLast1
Music Director: MDFirst1 MDFirst1
Stage Manager: SMFirst1 SMFirst1
Producer: ProducerFirst1 ProducerFirst1
Opening Night: December 16, 2014
我试图把它变成数据帧中的行的形式
年度,个人1个人,职位,显示职位
我不知道怎么做,一直走到死胡同。在
您没有确切地说明数据是如何存储的,所以我假设您有一堆与上面的类似的项,这些项是通过在文件中读取并在新行上拆分得到的。这将提供一个类似示例数据的字符串。在
将该字符串传递给函数:
基本上,在每个字符串上调用该函数
^{pr2}$然后}一起使用。在
pd.concat
与{相关问题 更多 >
编程相关推荐