官术网_书友最值得收藏!

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")
主站蜘蛛池模板: 农安县| 根河市| 水富县| 本溪| 安吉县| 聂拉木县| 陵水| 蛟河市| 栾川县| 龙海市| 绥棱县| 舞阳县| 滁州市| 玉田县| 永靖县| 山丹县| 太保市| 大埔区| 固原市| 安化县| 青冈县| 阳信县| 区。| 三河市| 龙里县| 曲靖市| 泸州市| 历史| 夏津县| 吉林省| 长乐市| 尖扎县| 孙吴县| 修文县| 海口市| 汉川市| 上思县| 抚州市| 伊通| 南平市| 钟山县|