1.读取Excel文件
1.1.读取数据
import pandas as pd
# Excel 文件的 URL 或本地路径
url = "https://www.gairuo.com/file/data/dataset/team.xlsx"
# 使用 Pandas 的 read_excel 函数读取数据
try:
df = pd.read_excel(url)
print(df.head()) # 打印 DataFrame 的前几行数据
except Exception as e:
print("读取文件时发生错误:", e)

- 所有数据
df #所有数据

- 查看前5条数据
df.head() #前5条

- 查看尾部5条数据
df.tail() #最后5条

- 随机查看数据
df.sample(5)#随机5条

- 查看行数和列数
df.shape

- 查看索引、数据类型和内存信息
df.info()

- 查看数值类型字段的统计信息
df.describe()

- 查看各个字段的类型
df.dtypes

- 显示数据行和列名
df.axes
- 列名
df.columns

1.2.建立索引
df.set_index('name',inplace=True)











![[数据库原理]关系范式总结(自用)](https://img-blog.csdnimg.cn/direct/ef1db0fe89f34de7959e76445a551884.jpeg)
![this.$refs[tab.$attrs.id].scrollIntoView is not a function](https://img-blog.csdnimg.cn/direct/9e23c60d80104bc89df5a32d498cdc98.png)







