Need help with charting qualitative values in a frequency table
For context: this code is a part of a college assignment.
I am working with a file where I need to create a frequency table for the occurrence of Vehicle Types. The data is nominal, and I am having trouble with the pandas cut() function.
# Library Importation
import numpy as np
import pandas as pd
# Import Data
df=pd.read_csv(r"C:\Users\Arjoh\Downloads\Assignment 5 and 7 DataSet.csv")
print(df)
# Creating custom boundaries using class interval
pd.crosstab(index=df['Vehicle_Type'], columns='Count')
boundaries= (72 - 9) / 5
print(boundaries)
#Implementing the interval
Interval = np.linspace(0,(75),5)
print(Interval)
#Cut the data and create a new DataFrame
df['Vehicle_class'] = pd.cut(df['Vehicle_Type'],Interval)
print(df)
The error code I get with trying the cut() function is:
TypeError: '<' not supported between instances of 'float' and 'str'
Any help or resources are greatly appreciated