【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

 菜鸟实战,坚持学习!

猜你喜欢

转载自blog.csdn.net/qq_39816613/article/details/126233829
今日推荐