You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "konjac (via GitHub)" <gi...@apache.org> on 2025/02/18 12:44:38 UTC
[I] Enhance `__repr__` and `_repr_html_` with a note for additional rows [datafusion-python]
konjac opened a new issue, #1026:
URL: https://github.com/apache/datafusion-python/issues/1026
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
Nowadays, `__repr__` and `_repr_html_` only shows 10 rows. If the DataFrame contains more than 10 rows, we can show message to indicate there are truncated rows.
**Describe the solution you'd like**
@timsaucer shared a thought in [#discussion_r1957173896](https://github.com/apache/datafusion-python/pull/1015#discussion_r1957173896). Just take 11 rows internally. If 11 rows are returned, display message for additional rows.
**Describe alternatives you've considered**
n/a
**Additional context**
n/a
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Enhance `__repr__` and `_repr_html_` with a note for additional rows [datafusion-python]
Posted by "kylebarron (via GitHub)" <gi...@apache.org>.
kylebarron commented on issue #1026:
URL: https://github.com/apache/datafusion-python/issues/1026#issuecomment-2666267228
You could also implement a "config" system like pandas uses, so the user can opt-in to displaying more columns or rows https://pandas.pydata.org/docs/user_guide/options.html#overview
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Enhance `__repr__` and `_repr_html_` with a note for additional rows [datafusion-python]
Posted by "timsaucer (via GitHub)" <gi...@apache.org>.
timsaucer closed issue #1026: Enhance `__repr__` and `_repr_html_` with a note for additional rows
URL: https://github.com/apache/datafusion-python/issues/1026
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Enhance `__repr__` and `_repr_html_` with a note for additional rows [datafusion-python]
Posted by "Spaarsh (via GitHub)" <gi...@apache.org>.
Spaarsh commented on issue #1026:
URL: https://github.com/apache/datafusion-python/issues/1026#issuecomment-2689730430
I'd like to work on this issue. Adding a few lines of code along the lines of:
```
fn __repr__(&self, py: Python) -> PyDataFusionResult<String> {
let df = self.df.as_ref().clone().limit(0, Some(11))?;
let batches = wait_for_future(py, df.collect())?;
let num_rows = batches.iter().map(|batch| batch.num_rows()).sum::<usize>();
let limited_batches = batches.iter().take(10).cloned().collect::<Vec<_>>();
let batches_as_string = pretty::pretty_format_batches(&limited_batches);
match batches_as_string {
Ok(batch) => {
if num_rows > 10 {
Ok(format!("DataFrame()\n{batch}\nand more..."))
} else {
Ok(format!("DataFrame()\n{batch}"))
}
}
Err(err) => Ok(format!("Error: {:?}", err.to_string())),
}
}
```
Should suffice, I suppose?
> You could also implement a "config" system like pandas uses, so the user can opt-in to displaying more columns or rows https://pandas.pydata.org/docs/user_guide/options.html#overview
As for the config, we'd need to decide on a particular format. I would suggest ```toml``` since it is used by ```Cargo```. But that in itself requires a new issue since I am sure there can be a host of other things that could benefit from this system.
We could start from this issue itself too if it is alright.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Enhance `__repr__` and `_repr_html_` with a note for additional rows [datafusion-python]
Posted by "timsaucer (via GitHub)" <gi...@apache.org>.
timsaucer commented on issue #1026:
URL: https://github.com/apache/datafusion-python/issues/1026#issuecomment-4216012033
Fixed in current release.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org