new_dissatisfied = combined_updated.pivot_table(values = "service_cat", index = "dissatisfied")
new_dissatisfied.plot(kind = "bar", title = "distribution of dissatisfied employees")
What I expected to happen:
Create a pivot table that aggregates “dissatisifed”
What actually happened:
DataError: No numeric types to aggregate
seems like its not converting my True/False values to 0 and 1
the exercise said " Recall that the dissatisfied column consists of Boolean values, meaning they’re either True or False . Methods such as the df.pivot_table() method actually treat Boolean values as integers, so a True value is considered to be 1 and a False value is considered to be 0 ."
Did you ever solve this issue? I noticed you used comb_updated.pivot_table() and the instructions say to do it that way. However, all of the documentation says it should go - pd.pivot_table(comb_updated,index=,values=)
Hi, yes I solved it. I had switched the index and value columns.
So the documentation says df. pivot_table (self, index, values),
but when you check the parameters, it starts from index and values.
not sure what the technical explanation is but we generally dont add the self (e.g series or df) as a parameter.
I ended up dropping the NaN values in dissatisfied to make sure there were no non-boolean values there. I have correct index and values. I have tried running both pd.pivot_table and combined_updated.pivot_table. I am still getting this same error.