当我运行我的脚本时,Pandas提供以下内容:'未来警告'
FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
我的剧本:
import io
data = io.StringIO('''A,B,M
AM,1,
AMC,2,
''')
df = pd.read_csv(data)
r=['CAR']
s=['CAR_M']
for i,j in zip(r,s):
df=df.append([{'A':i,'M':j}], ignore_index=True)
如果“ignore_index = False”,则会出现相同的警告。我不知道如何重新索引?
答案 0 :(得分:3)
似乎需要$(document).ready(function(){
var prevCount = 0;
$(".suborgamount").bind('keyup mouseup', function () {
var total_element = $('input[name=suborgamount]').val();
if (prevCount != total_element){
addRemoveDropdownList();
}
});
function addRemoveDropdownList() {
var total_element = $('input[name=suborgamount]').val();
prevCount = total_element;
var selectPickers = $(".suborgdropdownholder > select");
var container = $("<p class='col-md-4'>Selecteer deelorganisatie(s) waarvoor het lidmaatschap ook geactiveerd moet worden:</p>");
$('.suborgdropdownholder').html(container);
$(".selectpicker").not(':first').remove();
var nextIndex = 0;
for (var i = 0; i < total_element; i++){
var newselect = $('#orgdropdown').clone().attr({
style:'display: block !important',
id:'suborgdropdown_'+nextIndex
});
if (selectPickers[nextIndex]){
newselect.find('option[value='+ $(selectPickers[nextIndex]).val() +']').prop('selected', true);
}
$('.suborgdropdownholder').append(newselect);
nextIndex++;
}
}
});
构造函数才能正确添加新行:
Series