I am working through some statistics examples using Scitkit-learn (0.20.0), and trying to plot some things as I go with Seaborn (0.9.0). I keep encountering errors when I try to plot data sets I've combined using Pandas' concat() function.
Here is the most minimal example I could construct:
import numpy
import pandas
import seaborn
X = numpy.array([[-1, -1, "A"]])
P = numpy.array([[-0.8, -1]])
data_x = pandas.DataFrame(X, columns=('x','y','group'))
data_p = pandas.DataFrame(P, columns=('x','y'))
data_p['group'] = "B"
combined = pandas.concat([data_x, data_p], ignore_index=True, sort=True)
seaborn.scatterplot(data=combined, x='x', y='y')
This results in a traceback ending in:
TypeError: -0.8 is not a string
If I remove the 'A' and 'group' columns, there's no error. If I plot data_x or data_p separately, there's no error. But I'm using Seaborn to plot the results of supervised classification exercises, so having eg. columns for the 2D data plus category columns for grouping (eg. group is A or B differentiated by hue) and whether something was known or predicted (eg. kind is known or predicted differentiated by style) is very useful.
Hence I don't want to drop category columns just to avoid the errors here.
What am I doing wrong?
