【Python 实战基础】Pandas如何获取表格的信息和基本数据统计

目录

一、实战场景

二、主要知识点

文件读写

基础语法

Pandas

Pandas的Series对象

numpy

三、菜鸟实战

1、创建 python 文件

2、运行结果  


一、实战场景

实战场景:Pandas如何获取表格的信息和基本数据统计

二、主要知识点

  • 文件读写

  • 基础语法

  • Pandas

  • Pandas的Series对象

  • numpy

三、菜鸟实战

马上安排!

1、创建 python 文件

import pandas as pd
import numpy as np

df = pd.DataFrame(  data={  "norm": np.random.normal(loc=0, scale=1, size=1000),  "uniform": np.random.uniform(low=0, high=1, size=1000),  "binomial": np.random.binomial(n=1, p=0.2, size=1000)},  index=pd.date_range(start='2021-01-01', periods=1000))

# df.info(),查看多少行,多少列,类型等基本信息
# df.describe(),查看每列的平均值、最小值、最大值、中位数等统计信息;
print(df.info())
print()
print(df.describe())

2、运行结果  

DatetimeIndex: 1000 entries, 2021-01-01 to 2023-09-27
Freq: D
Data columns (total 3 columns):
 #   Column    Non-Null Count  Dtype
---  ------    --------------  -----
 0   norm      1000 non-null   float64
 1   uniform   1000 non-null   float64
 2   binomial  1000 non-null   int32
dtypes: float64(2), int32(1)
memory usage: 27.3 KB
None

              norm      uniform     binomial
count  1000.000000  1000.000000  1000.000000
mean     -0.028664     0.496156     0.215000
std       0.987493     0.292747     0.411028
min      -3.110249     0.000629     0.000000
25%      -0.697858     0.238848     0.000000
50%      -0.023654     0.503438     0.000000
75%       0.652157     0.746672     0.000000
max       3.333271     0.997617     1.000000

 菜鸟实战,坚持学习!

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

菜鸟实战

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值