- 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")
推薦閱讀
- 電力自動化實用技術問答
- Getting Started with Clickteam Fusion
- 手把手教你學AutoCAD 2010
- 精通Windows Vista必讀
- Learning Apache Cassandra(Second Edition)
- 自動檢測與傳感技術
- Matplotlib 3.0 Cookbook
- 深度學習中的圖像分類與對抗技術
- Pig Design Patterns
- 基于ARM 32位高速嵌入式微控制器
- 中國戰略性新興產業研究與發展·智能制造
- Visual Basic.NET程序設計
- 軟件工程及實踐
- Working with Linux:Quick Hacks for the Command Line
- Mastering Exploratory Analysis with pandas