Pareto function with DataFrames in Julia?

424 views Asked by At

Do you know where I can find max() min() functions for DataFrames in Julia? The data frame includes X,Y,Z coordinates. I want to find the highest value for the point with the highest x & y coordinate. Or should I do it with a "for loop" and a "if condition"?

1.EDIT: For example I have different points with X,Y,Z coordinates and I actually want to find the point with the highest X coordinate. I have done that with sorting the Data Frame. But how about finding the point with the highest X and Y coordinate? In combination... from all other points in the data.

2.EDIT: Pareto works great in that case, maybe it was my wrong explanation. How to use that principle to get all particle around the circle? The goal is to gain all related particles --> closed circle, of course it's only a approximation to a circle. Example conditions to reach the circle:

  1. Point: X & Y maximum
  2. Point: X & Y minimum
  3. Point: X maximum & Y maximum/2
  4. Point: X maximum/2 & Y maximum
  5. ...

Particle Plot

Thank you!

1

There are 1 answers

8
Bogumił Kamiński On

First generate the data:

julia> using DataFrames, PyPlot

julia> df = DataFrame(x=rand(1000), y=rand(1000));

julia> filter!(sdf -> sdf.x^2+sdf.y^2 < 1, df);

julia> scatter(df.x, df.y);

to get something like: enter image description here

Now you establish a Pareto front:

julia> sort!(df, rev=true);

julia> pareto = df[1:1, :];

julia> foreach(row -> row.y > pareto.y[end] && push!(pareto, row), eachrow(df));

julia> scatter(pareto.x, pareto.y);

to get: enter image description here

(you have the points belonging to the Pareto front plotted in orange)