Follow

groupby function groups by in local context. It actually groups only things that belong to single group inside continuous group.

Example:
group by of this stroke:
[k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B

What I actually expected it to do:

[k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D

@alexcleac "What I actually expected it to do:
...
A B C D"

s = set('AAAABBBCCDAABBB')
for i in sorted(s): print(i, end=" ")

A B C D

@alexcleac To be able to use Pandas' groupby you must have at least 2 groups of data. You have only one group in your example. :)

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!