Skip to content

Tag: pandas

Python – Getting keyError(key) when using groupBy.agg()

When I try to use the agg function, I’m getting raise KeyError(key) from err. What I”m trying to do is combine these based on the columns I’m grouping by and I want to take the first dict after grouping. I want the output to be what you see below and I don’t really care which “GM…

Find colums that contains lists

I have a huge pandas dataframe 150000 x 330 and I well find columns that have lists [] I have tried but it only returns column names. Answer You can try: Demo You can also find the list of columns with list as follows: Output:

Bokeh pie chart show percentage labels upside down

I have a dataframe with amounts grouped by categories and I want to generate a pie chart containing the percentages per category. I am using the Bokeh library in Python. My problem is that some percetange labels are not displayed properly in the pie chart as shown in the following image. Here is the code that…