# Python训练营笔记 从0完成一个数据分析实战 Day11

+关注继续查看

### 所记录的知识点

1. ndarray -> str

### ndarray -> str

ndarray(str类型元素) -> str
# ndarray -> str
print("np.array(['1','2','3','544','5'])\n",np.array(['1','2','3','544','5']),"\n")
print("type(np.array(['1','2','3','544','5']))\n",type(np.array(['1','2','3','544','5'])),"\n")

print("np.array(['1','2','3','544','5']).tolist()\n",np.array(['1','2','3','544','5']).tolist(),"\n")
print("type(np.array(['1','2','3','544','5']).tolist())\n",type(np.array(['1','2','3','544','5']).tolist()),"\n")

print("\" \".join(np.array(['1','2','3','544','5']).tolist())\n"," ".join(np.array(['1','2','3','544','5']).tolist()),"\n")
print("type(\" \".join(np.array(['1','2','3','544','5']).tolist()))\n",type(" ".join(np.array(['1','2','3','544','5']).tolist())),"\n")
np.array(['1','2','3','544','5'])
['1' '2' '3' '544' '5']

type(np.array(['1','2','3','544','5']))
<class 'numpy.ndarray'>

np.array(['1','2','3','544','5']).tolist()
['1', '2', '3', '544', '5']

type(np.array(['1','2','3','544','5']).tolist())
<class 'list'>

" ".join(np.array(['1','2','3','544','5']).tolist())
1 2 3 544 5

type(" ".join(np.array(['1','2','3','544','5']).tolist()))
<class 'str'> 

ndarray(int类型元素) -> str
# ndarray -> str
print("np.array([1,2,3,544,5])\n",np.array([1,2,3,544,5]),"\n")
print("type(np.array([1,2,3,544,5]))\n",type(np.array([1,2,3,544,5])),"\n")

print("np.array([1,2,3,544,5]).tolist()\n",np.array([1,2,3,544,5]).tolist(),"\n")
print("type(np.array([1,2,3,544,5]).tolist())\n",type(np.array([1,2,3,544,5]).tolist()),"\n")

print("\" \".join(str(i) for i in np.array([1,2,3,544,5]).tolist())\n"," ".join(str(i) for i in np.array([1,2,3,544,5]).tolist()),"\n")
print("type(\" \".join(str(i) for i in np.array([1,2,3,544,5]).tolist()))\n",type(" ".join(str(i) for i in np.array([1,2,3,544,5]).tolist())),"\n")
np.array([1,2,3,544,5])
[  1   2   3 544   5]

type(np.array([1,2,3,544,5]))
<class 'numpy.ndarray'>

np.array([1,2,3,544,5]).tolist()
[1, 2, 3, 544, 5]

type(np.array([1,2,3,544,5]).tolist())
<class 'list'>

" ".join(str(i) for i in np.array([1,2,3,544,5]).tolist())
1 2 3 544 5

type(" ".join(str(i) for i in np.array([1,2,3,544,5]).tolist()))
<class 'str'> 

Python训练营笔记 从0完成一个数据分析实战 Day10

0 0
Python数据分析——Matplotlib
----x:x轴数据，列表或数组，可选
0 0
Python绘制精美可视化数据分析图表(一)-Matplotlib

0 0
Python 数据分析 —— Matplotlib ②
Python 数据分析 —— Matplotlib ②
0 0
Python 数据分析 —— Matplotlib ①
Python 数据分析 —— Matplotlib ①
0 0
python数据分析之Matplotlib学习笔记

0 0
Python数据分析之matplotlib（二）

446 0
Python数据分析之matplotlib（一）
import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline years = [2010,2011,2012,2013,2014,20...
443 0
Python编程：MySQLdb模块对数据库的基本增删改查操作
Python编程：MySQLdb模块对数据库的基本增删改查操作
0 0
+关注

Python 系列直播——深入Python与日志服务，玩转大规模数据分析处理实战第二讲

Python第四讲——使用IPython/Jupyter Notebook与日志服务玩转超大规模数据分析与可视化