Created
December 27, 2018 10:01
-
-
Save zinyosrim/73d2d4d1163b08a0efac6c8007631033 to your computer and use it in GitHub Desktop.
Random triangle dataframe, lower half zeros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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