Skip to content

Instantly share code, notes, and snippets.

View owlas's full-sized avatar
Building Lightdash!

Oliver Laslett owlas

Building Lightdash!
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@owlas
owlas / pandas_bin_rows.py
Created November 23, 2016 17:49
Reshape pandas data frame by grouping rows and casting into new columns
import pandas as pd
# an example dataframe
df = pd.DataFrame.from_dict({
'content': ['some content', 'and text', 'more writing', 'words in a line'],
'url': ['a-url.com', 'cool.ai', 'random.xyz', 'here.there']
})
Nbins = 3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.