Giter Club home page Giter Club logo

Comments (9)

hosseinmoein avatar hosseinmoein commented on June 2, 2024 1

Yes

from dataframe.

hosseinmoein avatar hosseinmoein commented on June 2, 2024

There are a few ways of doing this:

If you have the whole data already in memory in one DataFrame, you can use slicing to get another DataFrame or another view (if you don't want a copy). In documentation look at get_[data|view]_by_...().

If you have the data in a file, you can read the file in chunks into multiple DataFrames. In documentation look at read().

from dataframe.

YingHREN avatar YingHREN commented on June 2, 2024

Thanks, if I get the view, could I do something like get_data_by_ on the view?

from dataframe.

YingHREN avatar YingHREN commented on June 2, 2024

Another question is that I want to first do groupby and then do the unique_value_count based on the group result. I should write my own visitor?

from dataframe.

YingHREN avatar YingHREN commented on June 2, 2024

template<typename T, typename I = unsigned long>
struct Unique_Value_Visitor {

using value_type = T;
using index_type = I;
using size_type = std::size_t;

using result_type = std::size_t;

explicit Unique_Value_Visitor(bool skipnan = true) : skip_nan_(skipnan) {}

inline void operator()(const index_type&, const value_type& val) {
    unique_values_.insert(val); 
}
PASS_DATA_ONE_BY_ONE

inline void pre() { 
    result_ = result_type{};
    unique_values_.clear(); 
}

inline void post() {}

inline std::size_t get_result() const { return 0; }

private:
result_type result_;
const bool skip_nan_;
std::unordered_set unique_values_;
};
I write a visitor like call it by std::make_tuple("a", "b", Unique_Value_Visitor())) this while the result does not have the "b" column I debug it it could get into the get_res function

from dataframe.

hosseinmoein avatar hosseinmoein commented on June 2, 2024

I am not sure why you need a visitor. You can call the group-by and then call the unique column value on the result of group-by.

from dataframe.

YingHREN avatar YingHREN commented on June 2, 2024

I do groupby on column "a", and groupby could store the column "b" value as a vector for every "a", How should I do that?

from dataframe.

hosseinmoein avatar hosseinmoein commented on June 2, 2024

Read the group by documentation including its code samples

from dataframe.

YingHREN avatar YingHREN commented on June 2, 2024

Thanks I will try something new on my side first.

from dataframe.

Related Issues (20)

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.