numpy学习

 

www.scipy.org

NumPy — NumPy  http://www.numpy.org/

https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html

Documentation — SciPy.org  https://scipy.org/docs.html#documentation--Overview — NumPy v1.14 Manual  https://docs.scipy.org/doc/numpy/--Quickstart tutorial--再查找相关方法或属性。如linspace

numpy错误提示:

故障1:执行import numpy as np过程中,错误提示:,提示:ImportError: cannot import name 'add_newdocs

解决方法:命令提示符输入:pip install -U numpy

输入命令并执行后提示如下:

D:\ProgramData\Anaconda3\Lib\site-packages>pip install -U numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/b0/b3/cfbdbb7a57a2f46cb4f
a894ded92ae501eed2543b86acfe20aca79463176/numpy-1.15.3-cp36-none-win32.whl
Installing collected packages: numpy
  Found existing installation: numpy 1.13.3
    Uninstalling numpy-1.13.3:
      Successfully uninstalled numpy-1.13.3
Successfully installed numpy-1.15.3
错误消除。

numpy的使用:

numpy:

import numpy as np
arr=np.array([1,12222,3])
arr#输出结果:array([    1, 12222,     3])
arr.dtype#输出结果:dtype('int32')
 
import numpy as np
arr=np.array([1,12222,3],dtype='U9')
arr

 

import pandas as pd
a=np.random.randint(0, 555555,100)        
b=pd.read_csv("000001.csv", "U6")    
head = ["表头1" , "表头2" , "表头3"]
l = [[1 , 2 , 3],[4,5,6] , [8 , 7 , 9]]
df = pd.DataFrame (l , columns = head)
df.to_csv("11.csv")
b=np.array([np.random.randint(2013, 2018, 3), np.random.randint(3, 10,3)])


b=pd.DataFrame(b, columns = head)
b.to_csv("12.csv")
print("b:", b)

 

axprofit_x1=db_b["任职开始期间"]#axprofit_x1为DataFrame型数据db_b表的“任职开始期间”列组成的表数据,字符串类型
axprofit_y1=np.array(db_b["任务目标"]).astype(np.float)#字符串类型转数字类型,做图中很方便

 

 

 

pandas写入csv文件 - CSDN博客  https://blog.csdn.net/skying_li/article/details/52530735

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值