python - I got an error in appending a dataframe row from one to another dataframe
问题描述
frontbar1_v_elements, frontbar1_h_elements, rearbar_elements, sidebar_up_elements, sidebar_down_elements
are the lists. draft_indep
is a dataframe with only one row and multiple columns, all cell attended as zero. total1
is a 2D list. The code is dedicated to change "1" to some certain "0" in a1
according to total1
. It works well to until this line. But the row in a1 could not be appended to main_indep
which is a dataframe. By the way, a1
was deep copied from draft_indep
and draft_indep
deep copied from main_indep
.
total1=[frontbar1_v_elements,frontbar1_h_elements,rearbar_elements,sidebar_up_elements,sidebar_down_elements]
a1=draft_indep.copy()
for single in total1:
for ele in single:
a1.at[0,ele]=int(1)
main_indep.append(a1, ignore_index=True)
解决方案
推荐阅读
- android - Android Sum Quantity values from two Columns in two tables and update the Quantity value in one Column with the summed value
- javascript - 如何在 React Native 上使用 StackNavigator 与 DrawerNavigator 和 SwitchNavigator?
- python - 熊猫和集合 - ValueError:值的长度与索引的长度不匹配
- node.js - JWT 认证 - 防止 JWT 令牌被盗
- vue.js - 按显示的文本(不是模型)对 Vuetify 表进行排序
- sublimetext3 - Sublime text Build 3200 的 Unicode 支持使得无法选择变音符号并分别可视化它们
- node.js - 找不到快速路由器发布路由
- c - 从c中的文件中读取分号后的“未固定”整数个数
- excel - 不同文件的相同代码/功能(用户友好的方法)
- c - 使用 C 语言中的堆栈进行中缀到后缀转换