@@ -652,7 +652,6 @@ def set_cartesian_axis_opts(args, axis, letter, orders):
652652
653653
654654def configure_cartesian_marginal_axes (args , fig , orders ):
655-
656655 nrows = len (fig ._grid_ref )
657656 ncols = len (fig ._grid_ref [0 ])
658657
@@ -1495,17 +1494,14 @@ def build_dataframe(args, constructor):
14951494 # If data_frame is provided, we parse it into a narwhals DataFrame, while accounting
14961495 # for compatibility with pandas specific paths (e.g. Index/MultiIndex case).
14971496 if df_provided :
1498-
14991497 # data_frame is pandas-like DataFrame (pandas, modin.pandas, cudf)
15001498 if nw .dependencies .is_pandas_like_dataframe (args ["data_frame" ]):
1501-
15021499 columns = args ["data_frame" ].columns # This can be multi index
15031500 args ["data_frame" ] = nw .from_native (args ["data_frame" ], eager_only = True )
15041501 is_pd_like = True
15051502
15061503 # data_frame is pandas-like Series (pandas, modin.pandas, cudf)
15071504 elif nw .dependencies .is_pandas_like_series (args ["data_frame" ]):
1508-
15091505 args ["data_frame" ] = nw .from_native (
15101506 args ["data_frame" ], series_only = True
15111507 ).to_frame ()
@@ -1859,7 +1855,6 @@ def _check_dataframe_all_leaves(df: nw.DataFrame) -> None:
18591855 for row_idx , row in zip (
18601856 null_indices_mask , null_mask .filter (null_indices_mask ).iter_rows ()
18611857 ):
1862-
18631858 i = row .index (True )
18641859
18651860 if not all (row [i :]):
@@ -1988,7 +1983,6 @@ def process_dataframe_hierarchy(args):
19881983
19891984 if args ["color" ]:
19901985 if discrete_color :
1991-
19921986 discrete_aggs .append (args ["color" ])
19931987 agg_f [args ["color" ]] = nw .col (args ["color" ]).max ()
19941988 agg_f [f'{ args ["color" ]} { n_unique_token } ' ] = (
@@ -2043,7 +2037,6 @@ def post_agg(dframe: nw.LazyFrame, continuous_aggs, discrete_aggs) -> nw.LazyFra
20432037 ).drop ([f"{ col } { n_unique_token } " for col in discrete_aggs ])
20442038
20452039 for i , level in enumerate (path ):
2046-
20472040 dfg = (
20482041 df .group_by (path [i :], drop_null_keys = True )
20492042 .agg (** agg_f )
@@ -2561,14 +2554,16 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
25612554 )
25622555
25632556 # With marginal histogram, if barmode is not set, set to "overlay"
2564- if "histogram" in [args .get ("marginal_x" ), args .get ("marginal_y" )] and "barmode" not in args :
2557+ if (
2558+ "histogram" in [args .get ("marginal_x" ), args .get ("marginal_y" )]
2559+ and "barmode" not in args
2560+ ):
25652561 layout_patch ["barmode" ] = "overlay"
25662562
25672563 # Set 'offsetgroup' only in group barmode (or if no barmode is set)
25682564 barmode = args .get ("barmode" ) or layout_patch .get ("barmode" )
2569- if (
2570- trace_spec .constructor in [go .Bar , go .Box , go .Violin , go .Histogram ]
2571- and (barmode == "group" or barmode is None )
2565+ if trace_spec .constructor in [go .Bar , go .Box , go .Violin , go .Histogram ] and (
2566+ barmode == "group" or barmode is None
25722567 ):
25732568 trace .update (alignmentgroup = True , offsetgroup = trace_name )
25742569 trace_names .add (trace_name )
@@ -2864,9 +2859,7 @@ def _spacing_error_translator(e, direction, facet_arg):
28642859 e .args = (
28652860 e .args [0 ]
28662861 + """
2867- Use the {facet_arg} argument to adjust this spacing.""" .format (
2868- facet_arg = facet_arg
2869- ),
2862+ Use the {facet_arg} argument to adjust this spacing.""" .format (facet_arg = facet_arg ),
28702863 )
28712864 raise e
28722865
0 commit comments