📜  如何在数据集python代码示例中拆分csv文件中的文本

📅  最后修改于: 2022-03-11 14:46:50.701000             🧑  作者: Mango

代码示例1
import pandas as pd
# a is the output list from the previous part of this answer
# Create list of texts. ::2 takes every other item from a list, starting with the FIRST one.
texts = a[::2][1:] 
print(texts)
# Create list of ID's. ::1 takes every other item from a list, starting with the SECOND one
ids = a[1::2]
print(ids)
df = pd.DataFrame({"IDs":ids,"Texts":texts})