Skip to content

Instantly share code, notes, and snippets.

Spencer Maroukis smaroukis

Block or report user

Report or block smaroukis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pandas_groupby_snippets
# for DateTimeIndexed DataFrames
for name, group in df.groupby([lambda x:, 'Some Feature']):
# within groupby object
# for dropping duplicate indices (sometimes a problem with DateTimeIndices)
group=group[~group.index.duplicated(keep = 'first')]
def col_to_int(col):
"""Converts excel COL to INT (zero indexed)"""
if len(col) == 1:
return ord(col.upper()) - ord('A')
if len(col) == 2:
n_alphabet = 26
return (col_to_int(col[0])+1)*n_alphabet+col_to_int(col[1])
You can’t perform that action at this time.