Code Monkey home page Code Monkey logo

Comments (4)

DFranzen avatar DFranzen commented on September 16, 2024 4

I am not sure how this is supposed to work with iloc, but replacing the line

        values = grouped_columns.iloc[0].to_dict()

by

        values = {}
        for name,val in grouped_columns.items():
            values[name] = val[0]

produces sensible results

from k-anonymity.

Arigato97 avatar Arigato97 commented on September 16, 2024

Have you found a solution? please

from k-anonymity.

Mousta1101 avatar Mousta1101 commented on September 16, 2024

i considered it as a list and removed the to_dict command but then there is another error it would really be useful if someone could help

from k-anonymity.

XDUqinian avatar XDUqinian commented on September 16, 2024

AttributeError: 'list' object has no attribute 'to_dict'

I got the same error. It could be found that the df. agg() returned a Series instead of a Dataframe, so I transformed it. this is workaround below.

grouped_columns = df.loc[partition].agg(aggregations, squeeze=False)
sensitive_counts = df.loc[partition].groupby(sensitive_column).agg({sensitive_column : 'count'})
#insert
df2=grouped_columns.to_frame()
grouped_columns=pd.DataFrame(df2.values.T,columns=df2.index)
#insert_end

from k-anonymity.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.