Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Relatorio

relatorio.livemd

Relatorio

Mix.install([
  {:kino, "~> 0.6.2"},
  {:kino_vega_lite, "~> 0.1.3"},
  {:explorer, "~> 0.3.1"},
  {:nx, "~> 0.2"}
])

Section

alias Explorer.DataFrame
alias Explorer.Series

pab_data = DataFrame.from_csv!("~/dev/UFV/INF222/trabalho-um/relatorio/ab.csv")

a =
  Series.transform(pab_data["% A"], fn s ->
    s
    |> String.replace(",", ".")
    |> String.replace("%", "")
    |> Float.parse()
    |> elem(0)
  end)
  |> Series.mean()

b =
  Series.transform(pab_data["% B"], fn s ->
    s
    |> String.replace(",", ".")
    |> String.replace("%", "")
    |> Float.parse()
    |> elem(0)
  end)
  |> Series.mean()

pab_data = [%{category: "% A", value: a}, %{category: "% B", value: b}]

VegaLite.new(width: 400, height: 400)
|> VegaLite.data_from_values(pab_data)
|> VegaLite.mark(:arc)
|> VegaLite.encode_field(:theta, "value", type: :quantitative)
|> VegaLite.encode_field(:color, "category", type: :nominal)