Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在这段代码中numpy.c_有什么用途?_Python_Numpy_Jupyter - Fatal编程技术网

Python 在这段代码中numpy.c_有什么用途?

Python 在这段代码中numpy.c_有什么用途?,python,numpy,jupyter,Python,Numpy,Jupyter,在本规范中,np.c是什么意思。从我的朋友那里学习 df_cancer = pd.DataFrame(np.c_[cancer['data'], cancer['target'], columns=np.append(cancer ['feature_names'],['target;])) 据官方NumPy称 numpy.c沿第二个轴将切片对象转换为串联 示例1: >>> np.c_[np.array([1,2,3]), np.array([4,5,6])] array(

在本规范中,
np.c
是什么意思。从我的朋友那里学习

df_cancer = pd.DataFrame(np.c_[cancer['data'], cancer['target'], columns=np.append(cancer ['feature_names'],['target;]))

据官方NumPy称

numpy.c沿第二个轴将切片对象转换为串联

示例1:

>>> np.c_[np.array([1,2,3]), np.array([4,5,6])]

array([[1, 4],
       [2, 5],
       [3, 6]])
>>> np.c_[np.array([[1,2,3]]), 0, 0, np.array([[4,5,6]])]

array([[1, 2, 3, 0, 0, 4, 5, 6]])
示例2:

>>> np.c_[np.array([1,2,3]), np.array([4,5,6])]

array([[1, 4],
       [2, 5],
       [3, 6]])
>>> np.c_[np.array([[1,2,3]]), 0, 0, np.array([[4,5,6]])]

array([[1, 2, 3, 0, 0, 4, 5, 6]])

文档告诉你了什么?没有,我只是通过视频学习代码,所以我不太明白它是什么,没关系。但在寻求帮助之前,先尝试自己解决一些轻微的挑战。Python及其大多数第三方库都有非常好的文档。如果你还不熟悉Python教程,你也可以先考虑阅读一个合适的Python教程。如果你看到一个你不熟悉的名字:查一下文档。当然,谢谢你,man
np.c_200;[cancer['data'],cancer['target']'
(添加了一个缺少的']'连接两列,可能是来自
cancer
dataframe的系列。这是一个有点模糊的列连接表达式。