example_df = [[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]]我想將 example_df pandas 數據框集成到現有的 Reportlab 表中 - 其中行數正在變化(如示例中所示可能為 3,也可能為 20):rlab_table(['Mean','Max','Min','TestA','TestB'],['','','','',''], ['','','','',''], ['','','','','']])我試過了:np.array(example_df).tolist() 但我收到此錯誤(AttributeError: 'int' object has no attribute 'wrapOn')我也試過:inputDF = example_df.loc[:,'col1':'col5']rlab_table(['Mean','Max','Min','TestA','TestB'],inputDF) 并且只出現數據幀的標題,而不是其中包含的數據(即使當我打印 inputDF 時我可以看到列出的所有數據)。我可以通過執行以下操作手動將每一行添加到報告實驗室表中:rlab_table(['Mean','Max','Min','TestA','TestB'],np.array(example_df).tolist()[0],np.array(example_df).tolist()[1], np.array(example_df).tolist()[2]])但是,問題是數據框中的行數在不斷變化,因此我正在尋求類似于以下內容的解決方案:rlab_table(['Mean','Max','Min','TestA','TestB'],np.array(example_df).tolist()[0:X])] #Where X is the number of rows in the dataframe
如何將 Pandas 數據框合并到現有的 reportlab 表中?
慕的地6264312
2021-11-09 15:45:15
