当前位置:网站首页>数据分析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)
边栏推荐
- Prufer序列
- 今年的很美味
- long investment career
- Deep learning Course2 first week Practical aspects of Deep Learning exercises
- NgRx Store createSelector 的单步调试和源代码分析
- xctf attack and defense world web master advanced area web2
- Ten years after graduation, financial freedom: those things that are more important than hard work, no one will ever teach you
- AQS
- 一种灵活的智能合约协作方式
- selenium无头,防检测
猜你喜欢
How to add a game character to a UE4 scene
_ _ determinant of a matrix is higher algebra eigenvalue of the product, the characteristic value of matrix trace is combined
render-props and higher order components
力扣第 304 场周赛复盘
使用分类权重解决数据不平衡的问题
【开源】Sentinel高性能高可用集群限流解决方案
Flutter基础学习(一)Dart语言入门
小程序毕设作品之微信体育馆预约小程序毕业设计成品(2)小程序功能
求解多元多次方程解的个数
【牛客刷题-SQL大厂面试真题】NO4.出行场景(某滴打车)
随机推荐
more grown, more lonely
用户体验 | 如何度量用户体验?
如何防范 DAO 中的治理攻击?
安全第五次课后练习
Wechat Gymnasium Reservation Mini Program Graduation Design Finished Work Mini Program Graduation Design Finished Product (2) Mini Program Function
企业公众号文章写作方向:如何写出读者认可的优质内容
[Mobile Web] Mobile terminal adaptation
46.全排列
Ten years after graduation, financial freedom: those things that are more important than hard work, no one will ever teach you
熟悉的朋友
(翻译)按钮的对比色引导用户操作的方式
03. GO language variable definition, function
Raspberry Pi information display small screen, display time, IP address, CPU information, memory information (C language), four-wire i2c communication, 0.96-inch oled screen
Implementation principle of VGUgarbage collector (garbage collector)
03、GO语言变量定义、函数
Postman 批量测试接口详细教程
【C语言实现】最大公约数的3种求法
NgRx Selector 的 Memoization 特性学习笔记
10年稳定性保障经验总结,故障复盘要回答哪三大关键问题?|TakinTalks大咖分享
工程建筑行业数据中台指标分析