pandas 函数数组操作[已关闭]

xytpbqjk  于 2023-01-04  发布在  其他
关注(0)|答案(1)|浏览(92)

已关闭。此问题需要details or clarity。当前不接受答案。
**想要改进此问题?**添加详细信息并通过editing this post阐明问题。

4小时前关门了。
Improve this question
Write the function array operation which accepts two number num1,num2 and perform array operations.

p1tboqfb

p1tboqfb1#

我希望它能为你的解决方案工作,使用numpy库它操作数组中的位元素

import numpy as np # import numpy library
def convert_2d(num_1, num_2):
    arr = np.arange(num_1, num_2 + 1) # [1, 2, 3, 4, 5, 6]
    # reshape [[1, 2, 3], [4, 5, 6]]
    return (np.reshape(arr, (2, 3)) ** 2) + 5
convert_2d(int(input('Enter no 1: ')), int(input('Enter no 2: ')))

相关问题