@@ -578,6 +578,28 @@ def infer_config(args, constructor, trace_patch):
578578 + ["error_y" , "error_y_minus" , "error_z" , "error_z_minus" ]
579579 + ["lat" , "lon" , "locations" , "animation_group" ]
580580 )
581+ array_attrables = ["dimensions" , "hover_data" ]
582+ group_attrables = ["animation_frame" , "facet_row" , "facet_col" , "line_group" ]
583+
584+ df_columns = args ["data_frame" ].columns
585+
586+ for attr in attrables + group_attrables + ["color" ]:
587+ if attr in args and args [attr ] is not None :
588+ maybe_col_list = [args [attr ]] if attr not in array_attrables else args [attr ]
589+ for maybe_col in maybe_col_list :
590+ try :
591+ in_cols = maybe_col in df_columns
592+ except TypeError :
593+ in_cols = False
594+ if not in_cols :
595+ value_str = (
596+ "Element of value" if attr in array_attrables else "Value"
597+ )
598+ raise ValueError (
599+ "%s of '%s' is not the name of a column in 'data_frame'. "
600+ "Expected one of %s but received: %s"
601+ % (value_str , attr , str (list (df_columns )), str (maybe_col ))
602+ )
581603
582604 attrs = [k for k in attrables if k in args ]
583605 grouped_attrs = []
@@ -645,7 +667,7 @@ def infer_config(args, constructor, trace_patch):
645667 args [position ] = args ["marginal" ]
646668 args [other_position ] = None
647669
648- for k in [ "animation_frame" , "facet_row" , "facet_col" , "line_group" ] :
670+ for k in group_attrables :
649671 if k in args :
650672 grouped_attrs .append (k )
651673
0 commit comments