Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
__repr__
for Column and ColumnAccessor (#7531)
## Summary: * Add a `__repr__` for Column (thin wrapper around the `__repr__` of the underlying pa.Array) * Add a `__repr__` for ColumnAccessor (similar to pa.Table, shows the names/types of the columns of the ColumnAccessor) ## Additional info: Debugging is sometimes made painful by the fact that we don't have a `__repr__` for columns and column accessors. For example, here's what a `ColumnAccessor` and a `Column` currently look like when printed...: ```python In [2]: cudf.DataFrame({'a': [1, 2, 3], "b": [4, 5, 6], "z_1": [2, 3, 4]})._data Out[2]: ColumnAccessor(OrderedColumnDict([('a', <cudf.core.column.numerical.NumericalColumn object at 0x7f0306336f80>), ('b', <cudf.core.column.numerical.NumericalColumn object at 0x7f03062a05f0>), ('z_1', <cudf.core.column.numerical.NumericalColumn object at 0x7f03062a0e60>)]), multiindex=False, level_names=(None,)) In [3]: cudf.Series([1, 2, None, 3])._column Out[3]: <cudf.core.column.numerical.NumericalColumn at 0x7f2190746710> ``` After this PR: ```python In [2]: cudf.DataFrame({'a': [1, 2, 3], "b": [4, 5, 6], "z_1": [2, 3, 4]})._data Out[2]: ColumnAccessor(multiindex=False, level_names=(None,)) a: int64 b: int64 z_1: int64 In [3]: cudf.Series([1, 2, None, 3])._column Out[3]: <cudf.core.column.numerical.NumericalColumn object at 0x7f3e90c2ac20> [ 1, 2, null, 3 ] dtype: int64 ``` Authors: - Ashwin Srinath (@shwina) Approvers: - Keith Kraus (@kkraus14) URL: #7531
- Loading branch information