Reputation: 501
I have currently strings in the form "0.123" saved in a pandas Dataframe in the "A" and integers in the column B. Now I try to create a barplot:
ax = sns.barplot(x='A', y='Y',
data=df)
However, the numbers in A are interpreted as floats. As some of the floats cannot be represented properly due to floating point precision. E.g.
E.g. 0.650 becomes 0.649999999999. How can I prevent seaborn from doing something like that? Visualizing data becomes pretty meaningless like this.
Upvotes: 0
Views: 257
Reputation: 455
Check your data everything should work fine!
import pandas as pd
import seaborn as sns
df = pd.DataFrame(data=[[1,2],[3,4]],columns=['A','Y'])
ax = sns.barplot(x='A', y='Y',
data=df)
Upvotes: 1