gpt4 book ai didi

python - 将 Pandas Dataframe 转换为 numpy 数组

转载 作者:太空宇宙 更新时间:2023-11-04 09:32:31 25 4
gpt4 key购买 nike

<分区>

下面是一个 Pandas dataframe df

index_column      value_column
0 20
2 28
1 30

需要转为numpy数组,其中index_column成为numpy数组的索引,value_column成为对应的值。

np_arr[0]=20np_arr[1]=30np_arr[2]=28等。

如何实现?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com