python - 如何在for循环中创建数组?

标签 python arrays indexing

for i in range(len(DH4_3)):
    Keqs=np.exp(-(DH4_3[i]-T4[i+127]*DS4)/(R*T4[i+127]))
    print(Keqs)

我想将索引[i]分配给每个Keqs[i]

目标是能够对 Keq 建立索引,例如能够将不同的数据调用为 Keqs[0]Keqs[1] 和等等

最佳答案

这应该有效

Keqs = []
for i in range(len(DH4_3)):
  Keqs[i]=np.exp(-(DH4_3[i]-T4[i+127]*DS4)/(R*T4[i+127]))
print(Keqs) # print out array after all items are added

关于python - 如何在for循环中创建数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54948120/

相关文章:

python - IndexError : tuple index out of range in python by using Raspberry pi

python - 将 Spark Dataframe 中的 float 列转换为 VectorUDT

php - 颠倒数组?

mysql - 错误 "A PRIMARY KEY must include all columns in the table' s 分区函数”

python - 在带有 ipywidgets 的 jupyter notebook 上使用 nbconvert 时,输出小部件出现在选项卡小部件之外

python - 根据纬度和日出时间计算经度?

c++ - 运行时读入 const int 的值 - C++

C++ 指针数组

mysql - 重复表字段与仅索引

javascript - 比较数组 Javascript 中索引元素内的数字