Reputation: 89
I am new to seaborn(version: '0.9.0'). I loaded my data from a CSV file in pandas but when I am trying to create the stripplot i get this error:
ValueError: Could not interpret input 'OS'
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sb
smartphones = pd.read_csv('D:\\Python Codes\\DataScience\\Smartphone.csv')
sb.stripplot(x='OS',y='Capacity',data=smartphones,size=10, jitter=True)
plt.show()
This is my CSV file:
This is the link to the CSV file: The CSV File
Upvotes: 2
Views: 1698
Reputation: 339052
For some reason some columns in the csv file have a blank space appended. This means that you need to access them with e.g. "OS "
instead of "OS"
. The following would hence work:
sb.stripplot(x='OS ',y='Capacity ',data=smartphones,size=10, jitter=True)
The more reliable way is of course to sanitize your input data prior to loading it. I.e. run a search/replace and replace " ,"
by ","
in the file.
Upvotes: 2