【发布时间】:2020-07-14 05:16:21
【问题描述】:
数据在需要转置(行)到列中的列中,对特殊字符(如“.”)有限制句号。在每个特殊字符(如“.”)之后,循环重复,直到整列变为行。 ,所以输出如下。
df :
index ID-0 ID-1 info_string
0 4 20 This
1 6 8 is
2 8 6 an
3 12 15 apple
4 29 9.
5 45 5 It
6 56 8 is
7 60 10 sweet
8 62 15 .
输出 df_out :
index ID-0 ID-1 info_string
0 4 6 8 12 29 20 8 6 15 9 This is an apple.
1 45 56 60 62 5 8 10 15 It is sweet.
还有。在此之后,再次如何恢复原始状态...
df_out_reverse:
index ID-0 ID-1 info_string
0 4 20 This
1 6 8 is
2 8 6 an
3 12 15 apple
4 29 9.
5 45 5 It
6 56 8 is
7 60 10 sweet
8 62 15 .
我尝试了转置,但我无法停止特殊字符。转置完成。
【问题讨论】: