Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DataFrame / Series inspect with limit: :infinity #737

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/explorer/backend/data_frame.ex
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,14 @@ defmodule Explorer.Backend.DataFrame do
for name <- DataFrame.names(df) do
series = df[name]

series =
case inspect_opts.limit do
:infinity -> series
limit when is_integer(limit) -> Series.slice(series, 0, limit + 1)
end

data =
series
|> Series.slice(0, inspect_opts.limit + 1)
|> Series.to_list()
|> Explorer.Shared.to_doc(inspect_opts)

Expand Down
7 changes: 6 additions & 1 deletion lib/explorer/backend/series.ex
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,14 @@ defmodule Explorer.Backend.Series do

dtype = A.color("#{type} ", :atom, inspect_opts)

series =
case inspect_opts.limit do
:infinity -> series
limit when is_integer(limit) -> Series.slice(series, 0, limit + 1)
end

data =
series
|> Series.slice(0, inspect_opts.limit + 1)
|> Series.to_list()
|> Explorer.Shared.to_doc(inspect_opts)

Expand Down
Loading