【发布时间】:2019-07-04 02:01:02
【问题描述】:
在 pandas 中加载了一个大小为 m*n 的 DataFrame,与列 n 相比,m 可以很大,值从 2 到 20。
m*n 中的每个值都必须添加到特定文本中,这意味着任何值之间的文本都是常量。
我尝试使用 For 和 If 嵌套句子,没有很好的结果如何从 df.iloc[0,0] 到 df.iloc[m,n] 并插入文本。
textA + df.iloc[0,0] + textB + df.iloc[0,1] + .... + textX + df.iloc[0,n]
textA + df.iloc[1,0] + textB + df.iloc[1,1] + .... + textX + df.iloc[1,n]
.
.
.
textA + df.iloc[m,0] + textB + df.iloc[m,1] + .... + textX + df.iloc[m,n]
我有 2 个文件,一个包括 textA textB ... textX 第二个文件是生成 pandas 数据框的 csv 类型。
上面有数据框和文本准备数组。
感谢任何提示。
【问题讨论】:
-
我不太明白你想要什么。您能否编辑您的问题并更清楚地写出您想要的结果?
标签: arrays python-3.x pandas