Skip to content

Instantly share code, notes, and snippets.

@rodigu
Created June 24, 2025 18:50
Show Gist options
  • Save rodigu/a51821116eadae34fd607bd3a6026ef8 to your computer and use it in GitHub Desktop.
Save rodigu/a51821116eadae34fd607bd3a6026ef8 to your computer and use it in GitHub Desktop.
a python one liner featuring the walrus operator
(a:=df.melt(value_vars=[qtt, val], id_vars=[moy, par, ven], var_name='type')).assign(**{mnt:a[moy] + '-' + a['type']})[[mnt,par,ven,'value']].pivot(columns=[mnt], index=[par,ven], values='value').to_csv('73-1.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment