elixir-explorer / explorer

Series (one-dimensional) and dataframes (two-dimensional) for fast and elegant data exploration in Elixir
https://hexdocs.pm/explorer
MIT License
1.12k stars 123 forks source link

Inspecting dataframes is not configurable through `Inspect.Opts`'s `:limit` #1025

Open LostKobrakai opened 7 hours ago

LostKobrakai commented 7 hours ago

Inspecting dataframes always truncates the printed records without being affected of inspects :limit. While I can see why it's not following the default of 50, it would sometimes still be useful to see more than the currently hardcoded 5.

billylanchantin commented 2 hours ago

First, you can use Explorer.DataFrame.print/2 which does accept a :limit argument. That might get you what you need in the short term.

Second, I was gonna say I worry about a :limit option for inspect because of how we currently format things. But we actually are smart enough to wrap longer columns across multiple lines. Example (see species):

iex> Explorer.Datasets.iris
#Explorer.DataFrame<
  Polars[150 x 5]
  sepal_length f64 [5.1, 4.9, 4.7, 4.6, 5.0, ...]
  sepal_width f64 [3.5, 3.0, 3.2, 3.1, 3.6, ...]
  petal_length f64 [1.4, 1.4, 1.3, 1.5, 1.4, ...]
  petal_width f64 [0.2, 0.2, 0.2, 0.2, 0.2, ...]
  species string ["Iris-setosa", "Iris-setosa", "Iris-setosa", "Iris-setosa",
   "Iris-setosa", ...]
>

So maybe a :limit option is totally reasonable.

I happen to be in the middle of a bug bash that involves inspect. I might cover this at some point while I'm in there.

josevalim commented 2 hours ago

The issue is the default value is too high. So we can’t respect it by default and then it is impossible for us to distinguish. Perhaps pointing to print is the best option.

LostKobrakai commented 2 hours ago

Yeah, unfortunate, but I agree that using the default 50 is not a good idea.