@@ -2486,11 +2486,29 @@ def __iter__(self):
24862486 yield self ._row_value_at_logical (i )
24872487
24882488
2489- class _NestedColumnNamespace :
2490- """Attribute proxy for dotted nested column paths.
2489+ class NestedColumn :
2490+ """A read-only accessor for a nested (dotted) group of CTable columns.
2491+
2492+ Returned by attribute access on a :class:`CTable` (or on another
2493+ ``NestedColumn``) when the name refers to an internal node of the dotted
2494+ column tree rather than a leaf. For a table flattened from a
2495+ ``struct``/``list<struct>`` schema, ``t.trip`` is a ``NestedColumn``
2496+ grouping every leaf under the ``trip.`` prefix, while a leaf such as
2497+ ``t.trip.sec`` (or ``t.trip.begin.lon``) is a :class:`Column`. Drilling
2498+ into an intermediate node (e.g. ``t.trip.begin``) yields another
2499+ ``NestedColumn``.
2500+
2501+ Exposes aggregate metadata over its descendant leaf columns
2502+ (:attr:`col_names`, :attr:`nrows`, :attr:`ncols`, :attr:`nbytes`,
2503+ :attr:`cbytes`, :attr:`cratio`) and an :attr:`info` report.
24912504
2492- Allows `t.trip.begin.lon` when the physical leaf column is named
2493- `"trip.begin.lon"`.
2505+ Examples
2506+ --------
2507+ >>> t.trip # doctest: +SKIP
2508+ <NestedColumn 'trip'>
2509+ >>> t.trip.col_names # doctest: +SKIP
2510+ ['sec', 'km', 'begin.lon', ...]
2511+ >>> t.trip.sec # a leaf -> Column # doctest: +SKIP
24942512 """
24952513
24962514 def __init__ (self , table : CTable , prefix : str ):
@@ -2600,11 +2618,11 @@ def __getattr__(self, name: str):
26002618 for col_name in self ._table .col_names :
26012619 parts = split_field_path (col_name )
26022620 if parts [: len (path_parts )] == path_parts and len (parts ) > len (path_parts ):
2603- return _NestedColumnNamespace (self ._table , path )
2621+ return NestedColumn (self ._table , path )
26042622 raise AttributeError (path )
26052623
26062624 def __repr__ (self ) -> str :
2607- return f"<NestedColumnNamespace { self ._prefix !r} >"
2625+ return f"<NestedColumn { self ._prefix !r} >"
26082626
26092627
26102628class _LazyColumnDict (dict ):
@@ -8536,7 +8554,7 @@ def _nested_namespace(self, prefix: str):
85368554 for name in self .col_names :
85378555 parts = split_field_path (name )
85388556 if parts [: len (prefix_parts )] == prefix_parts and len (parts ) > len (prefix_parts ):
8539- return _NestedColumnNamespace (self , prefix )
8557+ return NestedColumn (self , prefix )
85408558 return None
85418559
85428560 def __getattr__ (self , s : str ):
0 commit comments