0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

wslでelixir その179

Posted at

概要

wsl(wsl2じゃない)で、elixirやってみた。
練習問題やってみた。

練習問題

Livebookで、データフレームを使え。
新幹線のどの県がいつから新幹線駅を持つようになったかテーブルを作れ。

参考にしたページ

写真

image.png

サンプルコード

df3 = Explorer.DataFrame.arrange(df, col("開業"))
df3 = Explorer.DataFrame.group_by(df3, "開業")
df3 = Explorer.DataFrame.distinct(df3, ["県"])

kai = for i <- ken do
	Oz.put(i)
	m = Explorer.DataFrame.filter(df3, 県 == Oz.get)
	Explorer.Series.to_list(m["開業"])
end
|> Enum.map(fn x -> 
		x
		|> Enum.at(0)
  
end)
  

df4 = Explorer.DataFrame.new(県: ken, 開業: kai)

map = Explorer.DataFrame.to_series(df4)
gyo = Explorer.Series.to_list(map["開業"])
gyo = Enum.uniq(gyo)
gyo = Enum.sort(gyo)

Explorer.Series.from_list(gyo)

ken = for i <- gyo do
	Oz.put(i)
	m = Explorer.DataFrame.filter(df4, 開業 == Oz.get)
  Explorer.Series.to_list(m["県"])
end
|> Enum.map(fn x ->
		x
		|> Enum.map(fn y -> 
			y <> " "
		end)
end)

Kino.DataTable.new(開業: gyo, 県: ken)

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?