Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16448

How can I sort by a column while binning another

$
0
0

I am trying to cut float values of each country while grouping them by continent.This is the code that I wrote out:

groups = renew.groupby(['Continent'],pd.cut(renew['% Renewable'], 5))

Bug I am getting this error

TypeError: can only concatenate str (not "float") to str

I don't understand where it is trying to concatenate but I am trying to seperate the values in the '% Renewable' column into 5 bins.


Viewing all articles
Browse latest Browse all 16448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>