当前位置:网站首页>数据分析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)

边栏推荐
- Analysis of the development trend of game metaverse
- 易周金融分析 | 银行ATM机智能化改造提速;互联网贷款新规带来挑战
- SOM网络1:原理讲解
- 【开源】Sentinel高性能高可用集群限流解决方案
- number of solutions to solve a multivariate multi-degree equation
- 使用 Zokrates 在 BSV 上创建您的第一个 zkSNARK 证明
- 用户体验 | 如何度量用户体验?
- Deep Learning Course2 Week 2 Optimization Algorithms Exercises
- render-props and higher order components
- 使用分类权重解决数据不平衡的问题
猜你喜欢

【C语言实现】最大公约数的3种求法

【建议收藏】ヾ(^▽^*)))全网最全输入输出格式符整理

Prufer序列

xctf攻防世界 Web高手进阶区 webshell

How to add a game character to a UE4 scene

Ten years after graduation, financial freedom: those things that are more important than hard work, no one will ever teach you

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

SAP ABAP OData 服务如何支持删除(Delete)操作试读版
![[Niu Ke brush questions-SQL big factory interview questions] NO4. Travel scene (a taxi)](/img/26/4c3080f1b21efb9401d8c3a55bc15d.png)
[Niu Ke brush questions-SQL big factory interview questions] NO4. Travel scene (a taxi)

SOM Network 1: Principles Explained
随机推荐
如何理解 new (...args: any[]) => any
毕业十年,财富自由:那些比拼命努力更重要的事,从来没人会教你
【C语言实现】最大公约数的3种求法
威纶通触摸屏如何打开并升级EB8000旧版本项目并更换触摸屏型号?
SQL29 Calculate the average next day retention rate of users
恒星的正方形问题
2022-08-01 第八组 曹雨 泛型 枚举
xctf attack and defense world web master advanced area web2
familiar friend
NgRx Store createSelector 的单步调试和源代码分析
ImportError: `save_weights` requires h5py. Problem solved
【C语言】猜数字小游戏
Centos7--MySQL的安装
用户体验 | 如何度量用户体验?
Go 微服务开发框架DMicro的设计思路
_ _ determinant of a matrix is higher algebra eigenvalue of the product, the characteristic value of matrix trace is combined
线程池分析
03. GO language variable definition, function
小程序毕设作品之微信美食菜谱小程序毕业设计成品(7)中期检查报告
1. @Component注解的原理剖析