Skip to content

Filter Operation on DataFrame#12

Merged
Kriyszig merged 2 commits into
masterfrom
filter
Aug 26, 2019
Merged

Filter Operation on DataFrame#12
Kriyszig merged 2 commits into
masterfrom
filter

Conversation

@Kriyszig
Copy link
Copy Markdown
Owner

@Kriyszig Kriyszig commented Aug 19, 2019

The comparison with homogeneous branch is intentional to avoid unnecessarily long diffs. Once #11 is merged, I'll change the PR to point to master.
This was necessary as the homogeneous optimisation isn't in master yet.

Cc/ @thewilsonator

Comment thread source/magpie/dataframe.d Outdated
foreach(a, b; lockstep(indx.row.index, indx.row.codes))
{
ret.indx.row.index ~= a;
ret.indx.row.codes ~= dropper(positions, b);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

in general try to avoid doing allocations in a loop, in particular this can be refactored to

ret.indx.row.index = indx.row.index.dup;
ret.indx.row.codes = indx.row.codes.map!((e) => dropper(positions, e)).array.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Sorry about that 😅
Addressed in 3e3d0bb

Comment thread source/magpie/dataframe.d
Returns:
Filtered DataFrame
+/
auto filter(alias filterFunc)() @property
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is there any particular reason why you can't use https://dlang.org/phobos/std_algorithm_iteration.html#.filter ?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

It was mainly due to difference in data type of Homogeneous and Heterogeneous DataFrame.

Filter the rows of a dataframe based on the values returned by the alias function
@Kriyszig Kriyszig changed the base branch from homogeneous to master August 25, 2019 06:14
@Kriyszig Kriyszig closed this Aug 25, 2019
@Kriyszig Kriyszig reopened this Aug 25, 2019
* Fixed imports of aggregate
* Added filter documentation
@Kriyszig Kriyszig merged commit 52007f3 into master Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants