Reputation: 481
I have 2 variables with the following output:
xvals = [ 0. 0.6122449 1.2244898 1.83673469 2.44897959 3.06122449
3.67346939 4.28571429 4.89795918 5.51020408 6.12244898 6.73469388
7.34693878 7.95918367 8.57142857 9.18367347 9.79591837 10.40816327
11.02040816 11.63265306 12.24489796 12.85714286 13.46938776 14.08163265
14.69387755 15.30612245 15.91836735 16.53061224 17.14285714 17.75510204
18.36734694 18.97959184 19.59183673 20.20408163 20.81632653 21.42857143
22.04081633 22.65306122 23.26530612 23.87755102 24.48979592 25.10204082
25.71428571 26.32653061 26.93877551 27.55102041 28.16326531 28.7755102
29.3877551 30. ]
yvals = [ 1.08042695 1.29732901 1.5536316 1.85473976 2.20608434 2.61280247
3.07931361 3.60880018 4.202625 4.85974672 5.57622332 6.34491235
7.15547305 7.99474177 8.847487 9.69746943 10.5286583 11.32641498
12.07846336 12.77552085 13.41154314 13.98361401 14.49156649 14.93744511
15.32491328 15.65868667 15.94404387 16.18643764 16.39120969 16.56339873
16.70762551 16.82803663 16.92829061 17.01157226 17.08062432 17.13778845
17.18504993 17.22408234 17.25628996 17.28284669 17.30473078 17.32275544
17.33759523 17.34980878 17.35985809 17.36812476 17.37492375 17.38051477
17.38511185 17.38889129]
I'm trying to move these to a dataframe in the following format:
I've tried a few different things but I'm not sure if the fact that my outputs are space delimited rather than comma delimited are causing me issues
Upvotes: 1
Views: 423
Reputation: 863791
Use DataFrame contructor if need pass 2 numpy 1d arrays with same size:
df = pd.DataFrame({'xvals': xvals, 'yvals': yvals})
Upvotes: 1