当前位置:网站首页>数据分析04
数据分析04
2022-08-01 22:16:00 【88岁带伤编程】
一、数组的拼接
vstack和hstack方法
数组的行列交换
行交换和列交换
案例:
代码:
其中 axis=0是列,axis=1是行
numpy生成随机数
import numpy as np
ad=np.random.randint(10,20,(3,4)) #取不到20
ac=np.random.uniform(3,10,(3,4))
ae=np.random.normal(10,13,(3,4))
t=np.random.seed(10) #使用了随机种子,所以每一次的随机数都一样
af=np.random.randint(10,20,(3,4))
print(ad)
print("*"*50)
print(ac)
print("*"*50)
print(ae)
print("*"*50)
print(af)
* numpy的注意点:
二、numpy中的nan和inf
numpy中的clip(裁剪):
1.两个nan不相等
2.np.nan!=np,nan
numpy常用的统计函数
对nan进行合理的数字替换
t1=np.arange(12).reshape(3,4).astype("float")
t1[1,2:]=np.nan
print(t1)
def afs(t1):
for i in range(t1.shape[1]):
temp_col=t1[:,i]
nan_num=np.count_nonzero(temp_col!=temp_col)
if nan_num!=0:
temp_not_nan_col=temp_col[temp_col==temp_col]
temp_col[np.isnan(temp_col)]=temp_not_nan_col.mean()
return t1
print("*"*50)
t1=afs(t1)
print(t1)
边栏推荐
- HCIP---Multiple Spanning Tree Protocol related knowledge points
- 三、mysql 存储引擎-建库建表操作
- 03. GO language variable definition, function
- [Niu Ke brush questions-SQL big factory interview questions] NO4. Travel scene (a taxi)
- 解决 win10 下 ISE14.7的 iMPACT 崩溃问题 - FPGA 笔记
- User Experience | How to Measure User Experience?
- AQS
- 编曲软件FL studio20.8中文版功能和作用
- Delicious this year
- Small application project works WeChat stadium booking applet graduation design of the finished product (1) the development profile
猜你喜欢
HCIP---Multiple Spanning Tree Protocol related knowledge points
xctf attack and defense world web master advanced area webshell
找工作必备!如何让面试官对你刮目相看,建议收藏尝试!!
How to prevent governance attacks in DAOs?
【牛客刷题-SQL大厂面试真题】NO4.出行场景(某滴打车)
Small program -- subcontracting
感觉自己好傻
小程序毕设作品之微信美食菜谱小程序毕业设计成品(8)毕业设计论文模板
深度学习Course2第二周Optimization Algorithms习题整理
SOM网络2: 代码的实现
随机推荐
feel so stupid
Yizhou Financial Analysis | The intelligent transformation of bank ATM machines is accelerated; the new Internet loan regulations bring challenges
03. GO language variable definition, function
威纶通触摸屏如何打开并升级EB8000旧版本项目并更换触摸屏型号?
使用分类权重解决数据不平衡的问题
xctf攻防世界 Web高手进阶区 web2
Deep learning Course2 first week Practical aspects of Deep Learning exercises
Ten years after graduation, financial freedom: those things that are more important than hard work, no one will ever teach you
How to prevent governance attacks in DAOs?
Use Jenkins for continuous integration, this knowledge point must be mastered
9. SAP ABAP OData 服务如何支持删除(Delete)操作
深度学习Course2第一周Practical aspects of Deep Learning习题整理
Wechat Gymnasium Reservation Mini Program Graduation Design Finished Work Mini Program Graduation Design Finished Product (2) Mini Program Function
2022 版 MySQL 巅峰教程,收藏好,慢慢看
SAP Spartacus NgExpressEngineDecorator 的工作原理
NgRx Store createSelector 的单步调试和源代码分析
力扣第 304 场周赛复盘
字符串——Trie
联邦学习入门
高等代数_证明_矩阵的行列式为特征值之积, 矩阵的迹为特征值之和