Skip to content

Instantly share code, notes, and snippets.

View rmwoods's full-sized avatar

Rory Woods rmwoods

  • Preteckt
View GitHub Profile
@rmwoods
rmwoods / dup.py
Last active August 14, 2019 18:55
import pandas as pd
import numpy as np
df1 = pd.DataFrame([[1,np.nan]], index=[1], columns=["a","b"])
df2 = pd.DataFrame([[np.nan, 2]], ndex=[1], columns=["a","b"])
df3 = df1.append(df2)
# a b
# 1 1.0 NaN
# 1 NaN 2.0
a = np.arange(20).reshape(4,5)
#array([[ 0, 1, 2, 3, 4],
# [ 5, 6, 7, 8, 9],
# [10, 11, 12, 13, 14],
# [15, 16, 17, 18, 19]])
b = np.repeat(a,2).reshape(*a.shape,2)
#array([[[ 0, 0],
# [ 1, 1],
# [ 2, 2],
# [ 3, 3],