python - Concatenating Boolean to DataFrames sqlQuery str -
i attempting query weather database building decision trees. in there 14 instances , making new dataframes based on intend subset want query e.g -->
new_data = data.query("'rainy' in outlook")
will produce new dataframe 5 instances.
id d rainy mild high false yes e rainy cool normal false yes f rainy cool normal true no j rainy mild normal false yes n rainy mild high true no
to make program more dynamic iterating through datasets parsed headers
new_data = data.query("'rainy' in " + column_names[0])
where column_names[0] equal outlook. working fine , issue having when come windy boolean. question how parse boolean string make df query ? @ moment code reads
new_data = data.query("'" + false + "' in windy")
but error getting typeerror: cannot concatenate 'str' , 'bool' objects have tried many variations on concatenation have yet find correct format , if else has experienced same problem insight appreciated.
have tried following?
new_data = data.query("'" + str(false) + "' in windy")
Comments
Post a Comment