有没有一种方法可以用熊猫数据框中的值填充现有的空表?

时间:2019-08-01 14:57:10

标签: python python-pptx

我创建了一个3colx6row表,其中包含一些文本值,但是第二和第三列以及最后5行为空;我有两个单独的数据框,它们的值要分别放在第二列和第三列中。

我发现了与此代码相关的另一个问题:

for rows in urbanicity_table(in_rows+1):
     for cols in urbanicity_table(in_cols):
         if rows == 0:
            urbanicity_table.cell(rows, cols).text = str(" 
                {0:.2f}".format(urbanicity_footprint_df.iloc[rows-1,cols]))

但是我继续收到“ TypeError:'Table'对象不可调用”

urbanicity_footprint_df = urbanicity_df['Profile List: Total Profile 
Users/100 HHs'].reset_index().drop(['index'], axis=1)
urbanicity_0_df = urbanicity_df['Family Renters : Users/100 
HHs'].reset_index().drop(['index'], axis=1)

in_rows = urbanicity_footprint_df.shape[0]
in_cols = urbanicity_footprint_df.shape[1]

for rows in urbanicity_table(in_rows+1):
     for cols in urbanicity_table(in_cols):
         if rows == 0:
            urbanicity_table.cell(rows, cols).text = str(" 
{0:.2f}".format(urbanicity_footprint_df.iloc[rows-1,cols]))

我期望中间列的底部5行具有来自此现有数据帧的值,该数据帧包含1列和5行(具有5个值)。我需要用第三列的另一个单独的数据框来复制此过程。预先感谢!

0 个答案:

没有答案