Skip to content

Tag: pandas

Dataframe row slicing is not consistent

I have a DataFrame variable called data with ~ 6 mil rows and I’d like to process it 50 rows at a time. I have the following code: However it seems the slices obtained are not 50 rows in length. In fact they seem to be random (although every time I re-run the program they stay consistent. The first one

How to color dataframe based on each group?

I have a dataframe as below I want to color the dataframe for each Variable a different color for all columns. In the above figure, the selected variables should have one color, the below variable type should in another color etc., How can I color the dataframe in different colors for each Variable groups? An…