我想将字典列表转换为熊猫DF。一排看起来像这样:{'id': 5102, 'lat': 41.9258689, 'lng': -91.4231934}
当我查看type()时,我得到了int, float, float
temp_df = pd.DataFrame(geocode_list)
然后我得到了错误:AttributeError: 'NoneType' object has no attribute 'keys'
我不知道是什么原因引起的。
答案 0 :(得分:0)
如果您的字典不包含None,那么它将起作用:-
pd.DataFrame(list(geocode_list.items()), columns=['id', 'lat','lang'])
答案 1 :(得分:0)
产生了可能的问题,请检查以下修复程序:
// Create your popup with an menu option to switch to textselection modus:
PopupMenu popup = new PopupMenu(mCtx, view);
popup.inflate(R.menu.text_options_menu);
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case ...
case R.id.text_textisselectable:
view.setOnTouchListener(null);
((TextView)view).setTextIsSelectable( true);
((TextView)view).setFocusable( true);
((TextView)view).setLongClickable( true);
// Install a click listener to switch back to the previous Touch Listener
((TextView)view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PopupMenu popupx = new PopupMenu(mCtx, view);
popupx.inflate(R.menu.selecttext_back_menu);
popupx.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
((TextView)view).setTextIsSelectable( false);
((TextView)view).setFocusable( false);
((TextView)view).setLongClickable( false);
view.setOnTouchListener(onTouchListener);
return true;
}});
popupx.show();
}
});
break;