@@ -64,12 +64,23 @@ def _get_type_desc(self, obj):
6464 else :
6565 return f"({ type (obj ).__name__ } )"
6666
67+ def _get_column_type (self , series ):
68+ """Helper to get a simplified type description for a Series."""
69+ dtype = series .dtype
70+ if isinstance (dtype , pd .CategoricalDtype ):
71+ return "category"
72+ dt_str = str (dtype )
73+ if "int" in dt_str : return "int"
74+ if "float" in dt_str : return "float"
75+ if "object" in dt_str or "str" in dt_str : return "str"
76+ return dt_str
77+
6778 def _snapshot (self , adata ):
6879 """Captures keys, types, and shapes for comparison."""
6980 snapshot = {
7081 "shape" : adata .shape ,
71- "obs" : set (adata .obs . columns ) ,
72- "var" : set (adata .var . columns ) ,
82+ "obs" : { c : self . _get_column_type (adata .obs [ c ]) for c in adata . obs . columns } ,
83+ "var" : { c : self . _get_column_type (adata .var [ c ]) for c in adata . var . columns } ,
7384 "uns" : set (adata .uns .keys ()),
7485 # For complex slots, store a dict of {key: description_string}
7586 "obsm" : {k : self ._get_type_desc (v ) for k , v in adata .obsm .items ()},
@@ -146,8 +157,8 @@ def _print_report(self, start, end, duration):
146157 print (f"{ Style .BLUE } { V } { Style .RESET } { separator_text } { padding } { Style .BLUE } { V } { Style .RESET } " )
147158
148159 # Sections - use 6-char width for consistency
149- self ._print_section ("OBS" , start ['obs' ], end ['obs' ], width , title_width = 6 )
150- self ._print_section ("VAR" , start ['var' ], end ['var' ], width , title_width = 6 )
160+ self ._print_section ("OBS" , set ( start ['obs' ]. keys ()), set ( end ['obs' ]. keys ()) , width , descriptions = end [ 'obs' ] , title_width = 6 )
161+ self ._print_section ("VAR" , set ( start ['var' ]. keys ()), set ( end ['var' ]. keys ()) , width , descriptions = end [ 'var' ] , title_width = 6 )
151162 self ._print_section ("UNS" , start ['uns' ], end ['uns' ], width , is_uns = True , title_width = 6 )
152163 self ._print_section ("OBSP" , set (start ['obsp' ].keys ()), set (end ['obsp' ].keys ()), width , descriptions = end ['obsp' ], title_width = 6 )
153164 self ._print_section ("OBSM" , set (start ['obsm' ].keys ()), set (end ['obsm' ].keys ()), width , descriptions = end ['obsm' ], title_width = 6 )
@@ -176,8 +187,8 @@ def _print_section(self, title, start_keys, end_keys, width, is_uns=False, descr
176187 prefix_visible = f" { ' ' * spaces_needed } │"
177188
178189 if is_uns :
179- content = f"{ prefix_colored } { Style .GREEN } { key } { Style .RESET } "
180- visible_content = f"{ prefix_visible } { key } "
190+ content = f"{ prefix_colored } { Style .GREEN } ✚ { Style . RESET } { Style . YELLOW } { key } { Style .RESET } "
191+ visible_content = f"{ prefix_visible } ✚ { key } "
181192
182193 padding = " " * (width - 2 - len (visible_content ))
183194 print (f"{ V } { content } { padding } { V } " )
0 commit comments