You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Again, we start by grouping the input data by terrain classes, and then compute the sum of each classes’ area. This can be condensed into one line of code:
DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
Giving an extra argument made the warning go away without changing the output (see this Stack Overflow thread for further details):
https://autogis-site.readthedocs.io/en/latest/lessons/lesson-2/geopandas-an-introduction.html
Here it says:
And here's the corresponding expected output:
At least with my current version of pandas (2.2.3) and geopandas (1.0.1), I get the following error:
However, I was first able to recreate the desired output bit by bit. I started like so:
But I got a warning:
Giving an extra argument made the warning go away without changing the output (see this Stack Overflow thread for further details):
However, due to the way the
area
attribute in geopandas works, the output has an undesiredMultiIndex
:After further searching, I was finally able to match the desired output like so:
Here's the output:
I don't know whether what I did, with two
.groupby()
operations, is the ideal way to do things, but it worked.The text was updated successfully, but these errors were encountered: