For pandas related question on StackOverflow , people usually provide their sample data like below:
a b c d e
0 -0.420430 -0.394562 0.760232 0.152246 -0.671229
1 0.388447 0.676054 -0.058273 -0.246588 0.811332
2 -0.498263 -0.108011 0.952489 0.504729 -0.385724
3 1.069371 0.143752 0.414916 -1.180362 -0.029045
4 -0.245684 -0.150180 0.210579 0.063154 0.261488
5 0.064939 -0.396667 0.857411 -0.460206 0.039658
What's the most efficient way to create the data in my own jupyer notebook, so I can further investigate the question?
Usually, I will copy the data about to notepad and replace the space with comma and do the following code to create the sameple data:
data = np.array([-0.420430,-0.394562,0.760232,0.152246,...]) # paste the result from notepad here
df = pd.DataFrame(data.reshape(-1,5),columns=[HEADERS_OF_DATA]) # 5 is number of columns
However, this is quite slow and inconvenient. Is there any faster way to do so?