0

I'm trying to create a seaborn catplot. I read a csv datafile which includes data for 600 companies. I create four equal sized categories for the Environment Score column. I use this category as my x-axis variable and P/E-Ratio column is y-axis variable. Python displays the catplot and it looks as it should but it still displays the ValueError before the catplot. For example I managed to create a boxenplot with the same variables. The code that I used is below. What is wrong with it? Thank you in advance :)

import pandas as pd
import seaborn as sns

data_df  = pd.read_csv("assign_data.csv", delimiter = ";")

env_categ = pd.qcut(data_df['Environment Score'], 4)

sns.catplot(x=env_categ, y='P/E-Ratio', data=data_df, kind='violin')
Red
  • 26,798
  • 7
  • 36
  • 58
Turisti
  • 1
  • 1

1 Answers1

0

You try converting the variables to string data type either x or y is of int/ float format

df['env_categ'] = df['env_categ'].astype(str)
df['P/E-Ratio'] = df['P/E-Ratio'].astype(str)
Shikha
  • 229
  • 3
  • 5