6 ms·
In python its common to see code like this: df = pd.concat(df,other_df) df = df.select(...) ... My eyes hurts, when I see it. It makes me avoid python.
by acdbddh 11mo ago
In python its common to see code like this:
df = pd.concat(df,other_df)
df = df.select(...)
...
My eyes hurts, when I see it. It makes me avoid python.
I bet the reason for this mutable code is a missing simple pipes syntax.
I love pipes. In R can do:
df |>
rbind(other_df) |>
select(...)
It feels much better.
- mr_luc 11mo agoElixir too (Explorer library; default backend is Pola.rs based) - https://github.com/elixir-explorer/explorer https://github.com/elixir-explorer/explorer - https://hexdocs.pm/explorer/Explorer.html https://hexdocs.pm/explorer/Explorer.html
- fermisea 11mo agopandas has a .pipe operator which works exactly like this
- cubefox 11mo agoWouldn't that be simply: df = pd.concat(df,other_df).select(...)
- leviathan 11mo agoMy eyes would hurt more if I had to look all day at the vertical misalignment of that |> operator
- kec 11mo agoYou could always switch to a better font like Fira Code which has a ligature for this.
- adregan 11mo agoThe gp's comment wasn't made regarding the look of the operator in its ascii representation `|>` but about the vertical misalignment. Typically you align a pipeline like so: df |> rbind(other_df) |> select(...) But these topics are largely left to code formatters these days.
- kec 11mo agoWeird, I have always aligned as the gp showed. I’m reasonably sure tidyverse documentation does the same (which is probably where we both picked it up from).
- zenlot 11mo agoNah, it doesn't. Although you can do similar in Elixir.