I’ve been trying to map a column from my df into 4 categories (binning) but, the column contains mixed values in it: int and str, it looks something like this: The categories I’ve been tring to change them to: This has been the way I’ve been trying to solve this: But, I get this error: ValueError: shape mismatch: objects cannot
Tag: binning
Using Python Pandas to bin data in one df according to bins defined in a second df
I am attempting to bin data in one dataframe according to bins defined in a second dataframe. I am thinking that some combination of pd.bin and pd.merge might get me there? This is basically the form each dataframe is currently in: df: And this is the table with the bins, df2: I would like to match the bin, and find
Extending numpy.digitize to multi-dimensional data
I have a set of large arrays (about 6 million elements each) that I want to basically perform a np.digitize but over multiple axes. I am looking for some suggestions on both how to effectively do this but also on how to store the results. I need all the indices (or all the values, or a mask) of array A