Skip to content

Commit a85acf6

Browse files
get rid of
1 parent d8b337e commit a85acf6

File tree

2 files changed

+142
-137
lines changed

2 files changed

+142
-137
lines changed

packages/python/plotly/plotly/express/_core.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
+ ["ids", "error_x", "error_x_minus", "error_y", "error_y_minus", "error_z"]
2424
+ ["error_z_minus", "lat", "lon", "locations", "animation_group"]
2525
)
26-
array_attrables = ["dimensions", "custom_data", "hover_data", "path", "_column_"]
26+
array_attrables = ["dimensions", "custom_data", "hover_data", "path", "wide_variable"]
2727
group_attrables = ["animation_frame", "facet_row", "facet_col", "line_group"]
2828
renameable_group_attrables = [
2929
"color", # renamed to marker.color or line.color in infer_config
@@ -1083,7 +1083,7 @@ def process_args_into_dataframe(args, wide_mode, var_name):
10831083
)
10841084
# Check validity of column name
10851085
if argument not in df_input.columns:
1086-
if wide_mode and argument in ("_value_", var_name):
1086+
if wide_mode and argument in ("value", var_name):
10871087
continue
10881088
else:
10891089
err_msg = (
@@ -1154,7 +1154,7 @@ def process_args_into_dataframe(args, wide_mode, var_name):
11541154
pass
11551155
else:
11561156
args[field_name][i] = str(col_name)
1157-
if field_name != "_column_":
1157+
if field_name != "wide_variable":
11581158
wide_id_vars.add(str(col_name))
11591159

11601160
for col_name in ranges:
@@ -1215,8 +1215,8 @@ def build_dataframe(args, constructor):
12151215
)
12161216
if df_provided and no_x and no_y:
12171217
wide_mode = True
1218-
args["_column_"] = list(df_input.columns)
1219-
var_name = df_input.columns.name or "_column_"
1218+
args["wide_variable"] = list(df_input.columns)
1219+
var_name = df_input.columns.name or "variable"
12201220
if constructor == go.Funnel:
12211221
wide_orientation = args.get("orientation", None) or "h"
12221222
else:
@@ -1225,8 +1225,8 @@ def build_dataframe(args, constructor):
12251225
args["wide_cross"] = None
12261226
elif wide_x != wide_y:
12271227
wide_mode = True
1228-
args["_column_"] = args["y"] if wide_y else args["x"]
1229-
var_name = "_column_"
1228+
args["wide_variable"] = args["y"] if wide_y else args["x"]
1229+
var_name = "variable"
12301230
if constructor == go.Histogram:
12311231
wide_orientation = "v" if wide_x else "h"
12321232
else:
@@ -1272,8 +1272,8 @@ def build_dataframe(args, constructor):
12721272
# default and we let the normal auto-orientation-code do its thing later
12731273
other_dim = "x" if missing_bar_dim == "y" else "y"
12741274
if not _is_continuous(df_output, args[other_dim]):
1275-
args[missing_bar_dim] = "_count_"
1276-
df_output["_count_"] = 1
1275+
args[missing_bar_dim] = "count"
1276+
df_output["count"] = 1
12771277
else:
12781278
# on the other hand, if the non-missing dimension is continuous, then we
12791279
# can use this information to override the normal auto-orientation code
@@ -1287,14 +1287,14 @@ def build_dataframe(args, constructor):
12871287
# at this point, `df_output` is semi-long/semi-wide, but we know which columns
12881288
# are which, so we melt it and reassign `args` to refer to the newly-tidy
12891289
# columns, keeping track of various names and manglings set up above
1290-
wide_value_vars = [c for c in args["_column_"] if c not in wide_id_vars]
1291-
del args["_column_"]
1290+
wide_value_vars = [c for c in args["wide_variable"] if c not in wide_id_vars]
1291+
del args["wide_variable"]
12921292
del args["wide_cross"]
12931293
df_output = df_output.melt(
12941294
id_vars=wide_id_vars,
12951295
value_vars=wide_value_vars,
12961296
var_name=var_name,
1297-
value_name="_value_",
1297+
value_name="value",
12981298
)
12991299
df_output[var_name] = df_output[var_name].astype(str)
13001300
orient_v = wide_orientation == "v"
@@ -1305,24 +1305,24 @@ def build_dataframe(args, constructor):
13051305

13061306
if constructor in [go.Scatter, go.Funnel] + hist2d_types:
13071307
args["x" if orient_v else "y"] = wide_cross_name
1308-
args["y" if orient_v else "x"] = "_value_"
1308+
args["y" if orient_v else "x"] = "value"
13091309
if constructor != go.Histogram2d:
13101310
args["color"] = args["color"] or var_name
13111311
if constructor == go.Bar:
1312-
if _is_continuous(df_output, "_value_"):
1312+
if _is_continuous(df_output, "value"):
13131313
args["x" if orient_v else "y"] = wide_cross_name
1314-
args["y" if orient_v else "x"] = "_value_"
1314+
args["y" if orient_v else "x"] = "value"
13151315
args["color"] = args["color"] or var_name
13161316
else:
1317-
args["x" if orient_v else "y"] = "_value_"
1318-
args["y" if orient_v else "x"] = "_count_"
1319-
df_output["_count_"] = 1
1317+
args["x" if orient_v else "y"] = "value"
1318+
args["y" if orient_v else "x"] = "count"
1319+
df_output["count"] = 1
13201320
args["color"] = args["color"] or var_name
13211321
if constructor in [go.Violin, go.Box]:
13221322
args["x" if orient_v else "y"] = wide_cross_name or var_name
1323-
args["y" if orient_v else "x"] = "_value_"
1323+
args["y" if orient_v else "x"] = "value"
13241324
if constructor == go.Histogram:
1325-
args["x" if orient_v else "y"] = "_value_"
1325+
args["x" if orient_v else "y"] = "value"
13261326
args["y" if orient_v else "x"] = wide_cross_name
13271327
args["color"] = args["color"] or var_name
13281328

0 commit comments

Comments
 (0)