Skip to content

Instantly share code, notes, and snippets.

@zinyosrim
Created December 27, 2018 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zinyosrim/73d2d4d1163b08a0efac6c8007631033 to your computer and use it in GitHub Desktop.
Save zinyosrim/73d2d4d1163b08a0efac6c8007631033 to your computer and use it in GitHub Desktop.
Random triangle dataframe, lower half zeros
import numpy as np
import pandas as pd
N = 20
rand_matrix = np.asarray([random.randrange(1,11)/10 for _ in range(1, N*N+1) ]).reshape(N,N)
data = np.flip(np.triu(rand_matrix), 1)
df = pd.DataFrame(data, index=pd.date_range(start='2015-01-01', freq='MS', periods=N),\
columns = range(1,N+1))
df[1]=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment