python how to import excel data

You can use `pandas` library to import Excel data. Here is an example:

```python
import pandas as pd

# 读取Excel文件
data = pd.read_excel('data.xlsx')

# 打印前几行数据
print(data.head())
```

Among them, `data.xlsx` is your Excel file path. You can use the `read_excel` function to read an Excel file and store the data in a `DataFrame` object. Then, you can use the `head` method to print the first few lines of the data.

Guess you like

Origin blog.csdn.net/qq_26429153/article/details/131723002