- 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")
推薦閱讀
- Java編程全能詞典
- 大學(xué)計算機信息技術(shù)導(dǎo)論
- 電氣自動化專業(yè)英語(第3版)
- Microsoft Power BI Quick Start Guide
- 我的J2EE成功之路
- TIBCO Spotfire:A Comprehensive Primer(Second Edition)
- 精通Excel VBA
- 深度學(xué)習(xí)中的圖像分類與對抗技術(shù)
- 自主研拋機器人技術(shù)
- 21天學(xué)通Java
- 基于ARM 32位高速嵌入式微控制器
- Learning C for Arduino
- Prometheus監(jiān)控實戰(zhàn)
- Working with Linux:Quick Hacks for the Command Line
- Salesforce Advanced Administrator Certification Guide