@@ -413,12 +413,20 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
413413 # i.e. we can't do resampling, because then the X values might not line up!
414414 non_missing = ~ (x .is_null () | y .is_null ())
415415 trace_patch ["x" ] = (
416- sorted_trace_data .filter (non_missing )
417- .get_column (args ["x" ])
418- .to_numpy ()
416+ sorted_trace_data .filter (non_missing ).get_column (args ["x" ])
419417 # FIXME: Converting to numpy is needed to pass `test_trendline_on_timeseries`
420418 # test, but I wonder if it is the right way to do it in the first place.
421419 )
420+ if (
421+ trace_patch ["x" ].dtype == nw .Datetime
422+ and trace_patch ["x" ].dtype .time_zone is not None
423+ ):
424+ # Remove time zone so that local time is displayed
425+ trace_patch ["x" ] = (
426+ trace_patch ["x" ].dt .replace_time_zone (None ).to_numpy ()
427+ )
428+ else :
429+ trace_patch ["x" ] = trace_patch ["x" ].to_numpy ()
422430
423431 trendline_function = trendline_functions [attr_value ]
424432 y_out , hover_header , fit_results = trendline_function (
@@ -1166,7 +1174,7 @@ def to_unindexed_series(x, name=None, native_namespace=None):
11661174 its index reset if pandas-like). Stripping the index from existing pd.Series is
11671175 required to get things to match up right in the new DataFrame we're building.
11681176 """
1169- x = nw .from_native (x , series_only = True , strict = False )
1177+ x = nw .from_native (x , series_only = True , pass_through = True )
11701178 if isinstance (x , nw .Series ):
11711179 return nw .maybe_reset_index (x ).rename (name )
11721180 elif native_namespace is not None :
@@ -1372,7 +1380,7 @@ def process_args_into_dataframe(
13721380 )
13731381
13741382 df_output [str (col_name )] = to_unindexed_series (
1375- x = nw .from_native (argument , series_only = True , strict = False ),
1383+ x = nw .from_native (argument , series_only = True , pass_through = True ),
13761384 name = str (col_name ),
13771385 native_namespace = native_namespace ,
13781386 )
@@ -1500,11 +1508,11 @@ def build_dataframe(args, constructor):
15001508 is_pd_like = True
15011509
15021510 # data_frame is any other DataFrame object natively supported via Narwhals.
1503- # With strict=False , the original object will be returned if unable to convert
1511+ # With pass_through=True , the original object will be returned if unable to convert
15041512 # to a Narwhals DataFrame, making this condition False.
15051513 elif isinstance (
15061514 data_frame := nw .from_native (
1507- args ["data_frame" ], eager_or_interchange_only = True , strict = False
1515+ args ["data_frame" ], eager_or_interchange_only = True , pass_through = True
15081516 ),
15091517 nw .DataFrame ,
15101518 ):
@@ -1513,11 +1521,11 @@ def build_dataframe(args, constructor):
15131521 columns = args ["data_frame" ].columns
15141522
15151523 # data_frame is any other Series object natively supported via Narwhals.
1516- # With strict=False , the original object will be returned if unable to convert
1517- # to a Narwhals DataFrame , making this condition False.
1524+ # With pass_through=True , the original object will be returned if unable to convert
1525+ # to a Narwhals Series , making this condition False.
15181526 elif isinstance (
15191527 series := nw .from_native (
1520- args ["data_frame" ], series_only = True , strict = False
1528+ args ["data_frame" ], series_only = True , pass_through = True
15211529 ),
15221530 nw .Series ,
15231531 ):
0 commit comments