python 的 reshape强制转换格式的用途

python

shu=[[ 0.03046758],
 [ 0.05485586],
 [ 0.03282908],
 [ 0.02107211],
 [ 0.0391144 ],
 [ 0.07847244],
 [ 0.10637069],
 [ 0.10912484],
 [ 0.08255005],
 [ 0.04401289],
 [ 0.02652042],
 [ 0.04489684],
 [ 0.1125092 ],
 [ 0.20171609],
 [ 0.24182077],
 [ 0.22147825],
 [ 0.17367101],
 [ 0.11811587],
 [ 0.07583573],
 [ 0.05585619],
 [ 0.05152323],
 [ 0.05287309],
 [ 0.04390802],
 [ 0.02033866],
 [-0.01082659],
 [-0.04443245],
 [-0.07297837],
 [-0.09357257],
 [-0.11050943],
 [-0.12499658],
 [-0.13220942],
 [-0.14116618],
 [-0.1474861 ],
 [-0.155252  ],
 [-0.16157595],
 [-0.17522938],
 [-0.18979112],
 [-0.20707375],
 [-0.22559928],
 [-0.24433956],
 [-0.26274387],
 [-0.2792358 ],
 [-0.2918995 ],
 [-0.30031632],
 [-0.30415951],
 [-0.30241651],
 [-0.30166836],
 [-0.30418263],
 [-0.29483043],
 [-0.27100396],
 [-0.30452737],
 [-0.27459136],
 [-0.27864248],
 [-0.27988571],
 [-0.2789083 ],
 [-0.27418473],
 [-0.27133874],
 [-0.273573  ],
 [-0.27331436],
 [-0.26905285],
 [-0.29645602],
 [-0.29198681],
 [-0.30597401],
 [-0.31285284],
 [-0.32332745],
 [-0.33481348],
 [-0.29952983],
 [-0.2196518 ],
 [-0.24423494],
 [-0.10917666],
 [-0.03331556],
 [ 0.05794489],
 [ 0.1522982 ],
 [ 0.24289843],
 [ 0.31379792],
 [ 0.35726561],
 [ 0.37699762],
 [ 0.3739422 ],
 [ 0.35203614],
 [ 0.31527609],
 [ 0.26580783],
 [ 0.21018243],
 [ 0.1556581 ],
 [ 0.10579169],
 [ 0.06581611],
 [ 0.03638622],
 [-0.00533103],
 [-0.0293589 ],
 [-0.05506579],
 [-0.0717585 ],
 [-0.09598028],
 [-0.13153319],
 [-0.10989842],
 [-0.15002379],
 [-0.15520722],
 [-0.1622332 ],
 [-0.16408457],
 [-0.16169512],
 [-0.17450358],
 [-0.18534575],
 [-0.17270012],
 [-0.19752512],
 [-0.20017721],
 [-0.21014387],
 [-0.21785452],
 [-0.22602118],
 [-0.23225092],
 [-0.23509145],
 [-0.23430149],
 [-0.22991853],
 [-0.22357895],
 [-0.21192926],
 [-0.20029819],
 [-0.18923347],
 [-0.16496856],
 [-0.06325119],
 [-0.10145678],
 [-0.04094418],
 [ 0.0577558 ],
 [ 0.08034144],
 [ 0.14862435],
 [ 0.22222406],
 [ 0.2944974 ],
 [ 0.3652654 ],
 [ 0.42592842],
 [ 0.48287981],
 [ 0.56248249],
 [ 0.65665804],
 [ 0.72143514],
 [ 0.75846024],
 [ 0.80373626],
 [ 0.85883396],
 [ 0.91146142],
 [ 0.96240759],
 [ 1.00165196],
 [ 1.03795884],
 [ 1.12368034],
 [ 1.25278643],
 [ 1.34474068],
 [ 1.37975371],
 [ 1.52787595],
 [ 1.5499821 ],
 [ 1.66777954],
 [ 1.8497121 ],
 [ 2.15610857],
 [ 2.56392233],
 [ 2.88175638],
 [ 3.18699675],
 [ 3.43514615],
 [ 3.60349816],
 [ 3.57692858],
 [ 3.34846893],
 [ 2.96160833],
 [ 2.49356123],
 [ 2.07261385],
 [ 1.74797171],
 [ 1.501886  ],
 [ 1.32276945],
 [ 1.17914223],
 [ 1.05708848],
 [ 0.97265409],
 [ 0.91199395],
 [ 0.84668033],
 [ 0.77006946],
 [ 0.68142474],
 [ 0.59602731],
 [ 0.5462619 ],
 [ 0.53840576],
 [ 0.55995417],
 [ 0.59705898],
 [ 0.62808852],
 [ 0.64488628],
 [ 0.65316716],
 [ 0.65515926],
 [ 0.65434464],
 [ 0.6528444 ],
 [ 0.6485014 ],
 [ 0.64304678],
 [ 0.64050265],
 [ 0.64163942],
 [ 0.64580813],
 [ 0.65127549],
 [ 0.65448594],
 [ 0.65344521],
 [ 0.64775396],
 [ 0.63582883],
 [ 0.61580795],
 [ 0.5867806 ],
 [ 0.54812366],
 [ 0.50019051],
 [ 0.44436521],
 [ 0.38107205],
 [ 0.31008769],
 [ 0.23156126],
 [ 0.14558265],
 [ 0.05276   ],
 [-0.04557753],
 [-0.14853439],
 [-0.2553628 ],
 [-0.36458962],
 [-0.47451363],
 [-0.58290232],
 [-0.68702448],
 [-0.78530961],
 [-0.87713969],
 [-0.96206329],
 [-1.04016047],
 [-1.11128887],
 [-1.17495068],
 [-1.23130037],
 [-1.28083771],
 [-1.32375344],
 [-1.36026671],
 [-1.39021396],
 [-1.41307952],
 [-1.42918029],
 [-1.43937809],
 [-1.44465029],
 [-1.44629483],
 [-1.44493109],
 [-1.44046854],
 [-1.43306665],
 [-1.42282987],
 [-1.40949701],
 [-1.39282458],
 [-1.3721038 ],
 [-1.34619677],
 [-1.31490611],
 [-1.27874815],
 [-1.23807279],
 [-1.19357981],
 [-1.14578647],
 [-1.09478705],
 [-1.0420571 ],
 [-0.98949258],
 [-0.93809423],
 [-0.88856317],
 [-0.83846545],
 [-0.78447311],
 [-0.72511322],
 [-0.65841071],
 [-0.59092089],
 [-0.53413142],
 [-0.49026251],
 [-0.45659731],
 [-0.41718901],
 [-0.3549691 ]]

print(len(shu))
shu=np.array(shu)
print(shu.shape)
shu=shu.reshape(1,-1)                #对于无法显示的数组,如上面,我们可以强制转换格式
print(shu.shape)
print(shu)
plt.bar(range(247), shu[0])  
plt.show()
print(shu[0])

以上是 python 的 reshape强制转换格式的用途 的全部内容, 来源链接: utcz.com/z/387906.html

回到顶部