pandas.DataFrame(dtype=”category”) : For creating a categorical dataframe, dataframe() method has dtype attribute set to category.
All the columns in data-frame can be converted to categorical either during or after construction by specifying dtype=”category” in the DataFrame constructor.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course