@@ -652,7 +652,6 @@ def set_cartesian_axis_opts(args, axis, letter, orders):
652
652
653
653
654
654
def configure_cartesian_marginal_axes (args , fig , orders ):
655
-
656
655
nrows = len (fig ._grid_ref )
657
656
ncols = len (fig ._grid_ref [0 ])
658
657
@@ -1495,17 +1494,14 @@ def build_dataframe(args, constructor):
1495
1494
# If data_frame is provided, we parse it into a narwhals DataFrame, while accounting
1496
1495
# for compatibility with pandas specific paths (e.g. Index/MultiIndex case).
1497
1496
if df_provided :
1498
-
1499
1497
# data_frame is pandas-like DataFrame (pandas, modin.pandas, cudf)
1500
1498
if nw .dependencies .is_pandas_like_dataframe (args ["data_frame" ]):
1501
-
1502
1499
columns = args ["data_frame" ].columns # This can be multi index
1503
1500
args ["data_frame" ] = nw .from_native (args ["data_frame" ], eager_only = True )
1504
1501
is_pd_like = True
1505
1502
1506
1503
# data_frame is pandas-like Series (pandas, modin.pandas, cudf)
1507
1504
elif nw .dependencies .is_pandas_like_series (args ["data_frame" ]):
1508
-
1509
1505
args ["data_frame" ] = nw .from_native (
1510
1506
args ["data_frame" ], series_only = True
1511
1507
).to_frame ()
@@ -1859,7 +1855,6 @@ def _check_dataframe_all_leaves(df: nw.DataFrame) -> None:
1859
1855
for row_idx , row in zip (
1860
1856
null_indices_mask , null_mask .filter (null_indices_mask ).iter_rows ()
1861
1857
):
1862
-
1863
1858
i = row .index (True )
1864
1859
1865
1860
if not all (row [i :]):
@@ -1988,7 +1983,6 @@ def process_dataframe_hierarchy(args):
1988
1983
1989
1984
if args ["color" ]:
1990
1985
if discrete_color :
1991
-
1992
1986
discrete_aggs .append (args ["color" ])
1993
1987
agg_f [args ["color" ]] = nw .col (args ["color" ]).max ()
1994
1988
agg_f [f'{ args ["color" ]} { n_unique_token } ' ] = (
@@ -2043,7 +2037,6 @@ def post_agg(dframe: nw.LazyFrame, continuous_aggs, discrete_aggs) -> nw.LazyFra
2043
2037
).drop ([f"{ col } { n_unique_token } " for col in discrete_aggs ])
2044
2038
2045
2039
for i , level in enumerate (path ):
2046
-
2047
2040
dfg = (
2048
2041
df .group_by (path [i :], drop_null_keys = True )
2049
2042
.agg (** agg_f )
@@ -2561,14 +2554,16 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
2561
2554
)
2562
2555
2563
2556
# 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
+ ):
2565
2561
layout_patch ["barmode" ] = "overlay"
2566
2562
2567
2563
# Set 'offsetgroup' only in group barmode (or if no barmode is set)
2568
2564
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
2572
2567
):
2573
2568
trace .update (alignmentgroup = True , offsetgroup = trace_name )
2574
2569
trace_names .add (trace_name )
@@ -2864,9 +2859,7 @@ def _spacing_error_translator(e, direction, facet_arg):
2864
2859
e .args = (
2865
2860
e .args [0 ]
2866
2861
+ """
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 ),
2870
2863
)
2871
2864
raise e
2872
2865
0 commit comments