Skip to content

Instantly share code, notes, and snippets.

View rodigu's full-sized avatar
:electron:
☝️🤓

Rodrigo Morais rodigu

:electron:
☝️🤓
View GitHub Profile
@rodigu
rodigu / python-pandas-composite-id.md
Last active February 17, 2025 12:15
composite id column in dataframe

say we have a dataframe with many columns.

we want a new id column, which will be a concatenation of two or more columns in the dataframe.

this is useful in a case when we have a table without a "natural" id. for example a sales table with a client_id column, and a purchase_datetime.

this function will concat our columns:

@rodigu
rodigu / airflow-daemon-logs.md
Created February 14, 2025 10:45
how to check airflow webserver logs from daemon

reference

journalctl -u airflow-webserver.service
@rodigu
rodigu / python-golfing-walrus.md
Last active March 25, 2025 15:30
code golfing with the the assignment expression operator (the golfing walrus `:=`)

the walrus operator, introduced in python 3.8, has been quite an useful tool.

it's documentation gives some examples of its intended use:

if (n := len(a)) > 10:
    print(f"List is too long ({n} elements, expected <= 10)")

before the introduction of the walrus, you'd have to do: