Created
September 14, 2022 00:14
-
-
Save mhanberg/2c300fd6297c9b2e6c363d1c37820a56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"some.CSV" |> File.read!() |> NimbleCSV.RFC4180.parse_string() |> Enum.group_by(fn t -> if(Enum.at(t, 2) =~ "Amazon", do: "Amazon" , else: Enum.at(t, 2)) end) |> Enum.map(fn {category, ts} -> {category, Enum.map(ts, &String.to_float(Enum.at(&1, 5)) |> abs()) |> Enum.sum} end) |> Enum.sort_by(fn {k, v} -> v end, :desc) |> inspect(pretty: true, limit: :infinity) |> IO.puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment