Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregator #1156

Merged
merged 20 commits into from
Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions c/extras/aggregator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PyObject* aggregate(PyObject*, PyObject* args) {
return pydatatable::wrap(dt_out.release());
}

Aggregator::Aggregator(DataTable* dt_in){
Aggregator::Aggregator(DataTable* dt_in) {
create_dt_out(dt_in);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where's ~Aggregator() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dt_out is the dataframe created and returned by the aggregator to the user. I'm not sure we should destroy it when the aggregator is destroyed. Do you think we should?

Expand Down Expand Up @@ -95,7 +95,7 @@ void Aggregator::aggregate_2d(double epsilon, int32_t nx_bins, int32_t ny_bins)
case LT_INTEGER:
case LT_REAL: aggregate_2d_continuous(epsilon, nx_bins, ny_bins); break;
case LT_STRING: aggregate_2d_mixed(0, epsilon, nx_bins/*, ny_bins*/); break;
default: throw ValueError() << "Datatype is not supported";
default: throw ValueError() << "Datatype is not supported";
}
}
break;
Expand All @@ -106,7 +106,7 @@ void Aggregator::aggregate_2d(double epsilon, int32_t nx_bins, int32_t ny_bins)
case LT_INTEGER:
case LT_REAL: aggregate_2d_mixed(1, epsilon, nx_bins/*, ny_bins*/); break;
case LT_STRING: aggregate_2d_categorical(/*nx_bins, ny_bins*/); break;
default: throw ValueError() << "Datatype is not supported";
default: throw ValueError() << "Datatype is not supported";
}
}
break;
Expand Down
8 changes: 8 additions & 0 deletions datatable/extras/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python3
# © H2O.ai 2018; -*- encoding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#-------------------------------------------------------------------------------

__all__ = ("aggregate", )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, in order to export a symbol, you need to import or define it first.
However in your case (allow Python to find datatable.extras.aggregate) having an empty __init__.py should work just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was about to remove this line. Thanks!