Top "Categorical-data" questions

Statistical data type whose value is one of a fixed number of nominal categories.

How to correlate an Ordinal Categorical column in pandas?

I have a DataFrame df with a non-numerical column CatColumn. A B CatColumn 0 381.1396 7.343921 Medium 1 481.3268 6.786945 Medium 2 263.3766 7.628746 High 3 177.2400 5.225647 Medium-High I want to …

python pandas scikit-learn correlation categorical-data
How to know the labels assigned by astype('category').cat.codes?

I have the following dataframe called language lang level 0 english intermediate 1 spanish intermediate 2 spanish basic 3 english basic 4 english advanced 5 spanish …

python pandas dataframe categorical-data
How to create categorical variable based on a numerical variable

My DataFrame hase one column: import pandas as pd list=[1,1,4,5,6,6,30,20,80,90] df=pd.DataFrame({'col1':list}) How can I add …

python pandas dataframe categorical-data
Creating factor variables 'weekend' and 'weekday' from date

I have the following dataframe. This is just the head and the dates span over a period of 2 months. My …

r categorical-data
Matplotlib: how to plot a line with categorical data on the x-axis?

I am trying to plot a few lines (not a bar plot, as in this case). My y values are …

python matplotlib plot categorical-data
removing redundant columns when using get_dummies

Hi have a pandas dataframe df containing categorical variables. df=pandas.DataFrame(data=[['male','blue'],['female','brown'], ['male','black']],columns=[…

python pandas categorical-data
Extract the level from a factor

I have a factor instrumentF: > instrumentF [1] Guitar Drums Cello Harp Levels: Cello Drums Guitar Harp Let's say I extract …

r categorical-data
Tukey HSD for mixed continuous and categorical variables, error: "no factors"

I'm trying to run a Tukey test on mortality data, where I want to test whether mortality is influenced by …

r anova categorical-data continuous
How to check if a variable is categorical with R?

I have an R data frame and some of the variables are categorical. For example sex is "male" or "female" …

r dataframe categorical-data
Is it possible to read categorical columns with pandas' read_csv?

I have tried passing the dtype parameter with read_csv as dtype={n: pandas.Categorical} but this does not work …

file csv pandas readfile categorical-data