Skip to content

Instantly share code, notes, and snippets.

View paurue's full-sized avatar
👓

Pau Rué paurue

👓
  • Barcelona
  • 01:44 (UTC +02:00)
View GitHub Profile
@paurue
paurue / explode.py
Created May 7, 2019 08:42
Pandas explode DataFrame Field
def explode_field(df, field):
remaining_cols = df.columns.drop(field)
return df[field] \
.apply(pd.Series) \
.merge(df, right_index=True, left_index=True) \
.drop(field, axis=1) \
.melt(id_vars=remaining_cols, value_name=field)
Rain Sprinkler Wet grass
False False False
False True True
False False False
False True True
True False True
False False False
False True True
False False False
False False False

Keybase proof

I hereby claim:

  • I am paurue on github.
  • I am paurue (https://keybase.io/paurue) on keybase.
  • I have a public key ASBECeTx9lPPjquudRIKc4IElVBdvxD3DsKsLfS-_QZRZgo

To claim this, I am signing this object:

2015-10-31 15:12:21 +0000
./configure
--disable-dependency-tracking
--prefix=/usr/local/Cellar/arpack-julia/3.2.0
--enable-shared
--with-blas=openblas
--with-lapack=openblas
checking for a BSD-compatible install... /usr/bin/install -c
2015-10-31 15:10:12 +0000
./configure
--disable-dependency-tracking
--prefix=/usr/local/Cellar/arpack-julia/3.2.0
--enable-shared
--with-blas=openblas
--with-lapack=openblas
checking for a BSD-compatible install... /usr/bin/install -c