Pandas:执行groupby时'在df中创建切片副本中的值'错误

时间:2016-05-13 20:35:16

标签: python pandas group-by

我正在使用数据框:

public class ViewService extends Service implements android.view.KeyEvent.Callback  {

    @Override
    public void onCreate() {
        super.onCreate();
    }


    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return false;
    }

    @Override
    public boolean onKeyLongPress(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK)
        {
            Intent intent = new Intent( ViewService.this, MainActivity.class);
       startActivity(intent);
            return true;
        }
        return false;
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        return false;
    }

    @Override
    public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
        return false;
    }
}

这是我收到错误的地方。我之前用类似的dfs执行过这个命令;偶尔我会收到这个错误,但它似乎永远不会成为问题。

mpl.head(1)
    cid     state   naics   year    log_diff_subsidies  log_diff_empcomp    log_diff_taxes  log_diff_rgdp   unemployment    party   date    bills   leg_totalbills  years_exp   prefix  disposition     catcode
0   N00003389   KY  518, 519    2013.0  NaN     NaN     NaN     NaN     8.1     Republican  2013    s1626-113   5   29  s   support     G5200

mpl_interest=mpl[['date', 'catcode', 'disposition', 'cid', 'bills']]

mpl_interest['billsum'] = mpl_interest.groupby(['date', 'catcode','disposition', 'cid'])['bills'].transform('nunique')

有谁知道我是否应该非常担心它?是否有一个小的语法调整我可以避免它?

0 个答案:

没有答案