Feb-02-2018, 04:59 PM
Hey guys !
I was trying to make a 4*54 random numbers DataFrame. I spent 1 hour trying to figure out how to do it and I wrote this code :
What do you think about it ? :)
Have a nice day all !
I was trying to make a 4*54 random numbers DataFrame. I spent 1 hour trying to figure out how to do it and I wrote this code :
import pandas as pd from random import randint df = pd.DataFrame() for i in range(53): data1 = pd.DataFrame([randint(1,3)]) data2 = pd.DataFrame([randint(1,3)]) data3 = pd.DataFrame([randint(1,3)]) data4 = pd.DataFrame([randint(1,3)]) data = pd.DataFrame(pd.concat([data1, data2, data3, data4], axis =1, join_axes=[data1.index])) df = df.append(data, ignore_index = True)I'm satisfied with the result but I think there should be a better way to do it.
What do you think about it ? :)
Have a nice day all !