- Hands-On Artificial Intelligence for IoT
- Amita Kapoor
- 116字
- 2021-07-02 14:02:00
Using pandas with XLSX files
We can load existing .xlsx files with the help of pandas. The read_excel method is used to read Excel files as a DataFrame. This method uses an argument, sheet_name, which is used to specify the sheet we want to load. The sheet name can be specified either as a string or number starting from 0. The to_excel method can be used to write into an Excel file.
The following code reads an Excel file, manipulates it, and saves it. The code can be accessed from GitHub at Pandas_xlsx_example.ipynb:
import pandas as pd
df = pd.read_excel("empty_book.xlsx", sheet_name=0)
df.describe()
result = df * 2
result.describe()
result.to_excel("empty_book_modified.xlsx")
推薦閱讀
- Word 2003、Excel 2003、PowerPoint 2003上機指導與練習
- 機器學習實戰:基于Sophon平臺的機器學習理論與實踐
- Ansible Configuration Management
- 輕松學C#
- Hands-On Machine Learning on Google Cloud Platform
- Matplotlib 3.0 Cookbook
- Hands-On Cybersecurity with Blockchain
- 中國戰略性新興產業研究與發展·智能制造
- 構建高性能Web站點
- Troubleshooting OpenVPN
- 學練一本通:51單片機應用技術
- 從零開始學JavaScript
- C#求職寶典
- 深度學習原理與 TensorFlow實踐
- PyTorch深度學習