Skip to content

Tag: pandas

Pandas dataframe.dot division method

I am trying to divide two series of different length to return the matrix product dataframe of them. I can multiply them using the dot method (from this answer): I’ve tried the div method, but this just fills the dataframe with NaNs: Likewise the standard division operator also returns the same result: …

Ordered Logit in Python?

I’m interested in running an ordered logit regression in python (using pandas, numpy, sklearn, or something that ecosystem). But I cannot find any way to do this. Is my google-skill lacking? Or is this not something that’s been implemented in a standard package? Answer Update: Logit and Probit Ord…

How do you represent missing data in a Pandas DataFrame?

Does Pandas have an equivalent of R’s na (meaning not available)? If not, what is the convention for representing a missing value, as opposed to NaN which represents a mathematically impossible value such as a divide by zero? Answer Currently there is no NA value available in Pandas or NumPy. From the s…

Check if dataframe column is Categorical

I can’t seem to get a simple dtype check working with Pandas’ improved Categoricals in v0.15+. Basically I just want something like is_categorical(column) -> True/False. We can see that the dtype for the categorical column is ‘category’: And normally we can do a dtype check by just …