Skip to content Skip to sidebar Skip to footer

Python - How To To_csv() With An Column Of Arrays

I have data containing some large arrays in a .csv like: df = pd.DataFrame() for x in range(1, 6): data = {'a':x, 'b':np.array(range(1, 10000))} df = df.appen

Solution 1:

You can change the numpy printing threshold with set_printoptions():

threshold: Total number of array elements which trigger summarization rather than full repr (default 1000). To always use the full repr without summarization, pass sys.maxsize.

np.set_printoptions(threshold=100000) # or threshold=sys.maxsize
df.to_csv('./src/temp/test.csv', index=True)

Post a Comment for "Python - How To To_csv() With An Column Of Arrays"