Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • This is the answer at least for the second part. I knew that it should be possible. Such simple and pythonic solution! Thank you very much! Commented Mar 29, 2020 at 22:07
  • 8
    This is a very expensive solution, though, for larger datasets. Commented Aug 20, 2020 at 14:59
  • 1
    Could you elaborate on your observation? Commented Aug 21, 2020 at 20:28
  • "then you use those index values to get multi-column slices from your original DataFrame" - do you mean .iloc[i, c] to reach into the dataframe from inside masscenter? i.e. masscenter doesn't have the arguments it needs directly? Commented Jan 18, 2021 at 3:10
  • 6
    Works for me though pandas' devs should really implement this somehow... Commented Apr 15, 2021 at 15:51