@@ -988,20 +988,25 @@ def build_dataframe(args, attrables, array_attrables):
988
988
if isinstance (argument , str ) or isinstance (
989
989
argument , int
990
990
): # just a column name given as str or int
991
- bypass_warnings = (
992
- hover_data_is_dict
993
- and argument in args ["hover_data" ]
994
- and args ["hover_data" ][argument ][1 ] is not None
995
- )
996
- if not df_provided and not bypass_warnings :
991
+
992
+ if (
993
+ field_name == "hover_data"
994
+ and hover_data_is_dict
995
+ and args ["hover_data" ][str (argument )][1 ] is not None
996
+ ):
997
+ col_name = str (argument )
998
+ df_output [col_name ] = args ["hover_data" ][col_name ][1 ]
999
+ continue
1000
+
1001
+ if not df_provided :
997
1002
raise ValueError (
998
1003
"String or int arguments are only possible when a "
999
1004
"DataFrame or an array is provided in the `data_frame` "
1000
1005
"argument. No DataFrame was provided, but argument "
1001
1006
"'%s' is of type str or int." % field
1002
1007
)
1003
1008
# Check validity of column name
1004
- if not bypass_warnings and argument not in df_input .columns :
1009
+ if argument not in df_input .columns :
1005
1010
err_msg = (
1006
1011
"Value of '%s' is not the name of a column in 'data_frame'. "
1007
1012
"Expected one of %s but received: %s"
@@ -1012,7 +1017,7 @@ def build_dataframe(args, attrables, array_attrables):
1012
1017
"\n To use the index, pass it in directly as `df.index`."
1013
1018
)
1014
1019
raise ValueError (err_msg )
1015
- if not bypass_warnings and length and len (df_input [argument ]) != length :
1020
+ if length and len (df_input [argument ]) != length :
1016
1021
raise ValueError (
1017
1022
"All arguments should have the same length. "
1018
1023
"The length of column argument `df[%s]` is %d, whereas the "
@@ -1025,14 +1030,7 @@ def build_dataframe(args, attrables, array_attrables):
1025
1030
)
1026
1031
)
1027
1032
col_name = str (argument )
1028
- if (
1029
- field_name == "hover_data"
1030
- and hover_data_is_dict
1031
- and args ["hover_data" ][col_name ][1 ] is not None
1032
- ):
1033
- df_output [col_name ] = args ["hover_data" ][col_name ][1 ]
1034
- else :
1035
- df_output [col_name ] = df_input [argument ].values
1033
+ df_output [col_name ] = df_input [argument ].values
1036
1034
# ----------------- argument is a column / array / list.... -------
1037
1035
else :
1038
1036
is_index = isinstance (argument , pd .RangeIndex )
0 commit comments