Skip to content

Tag: pandas

Multiple Seaborn Heatmaps from Pandas Dataframe

I have a Pandas dataframe that looks like this: Where there are ~60 stores and the ratings range from 0 – 2. I would like to create a 6×5 grid Seaborn of heatmaps, with one heatmap per store. I would like for the x-axis to be the days and for the y-axis to be the times. I tried this: This

Row-level cumulative sum with condition

I have a table that looks like this. m1 m2 m3 m4 m5 m6 m7 m8 s 0 1 0 0 5 0 4 10 4 4 1 8 0 15 0 4 10 10 I need to know at which position or column the row-level cumulative sum for the first six columns (m1 to m6) either equals or exceeds

KeyError when using loc from pandas

I have a simple CSV-file which I import as a dataframe. Using df.columns I get the following: Index([‘Unnamed: 0’, ‘age’, ‘sex’, ‘bmi’, ‘bp’, ‘s1’, ‘s2’, ‘s3’, ‘s4’, ‘s5’, ‘s6’, …

Column merge and shift elements in a Dataframe row

I have a dataframe as follows: In the last row (and several others in the full dataframe) the negative signs are misplaced. My question is if a negative sign is there at i-th position then it should merge i+1 th element and shift all other row elements to the left such that it the final output should be Answe…