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

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")
主站蜘蛛池模板: 德庆县| 三门县| 北安市| 罗田县| 瑞昌市| 安新县| 石阡县| 宁化县| 和硕县| 许昌市| 柳林县| 东辽县| 安陆市| 庆安县| 江永县| 黔南| 长汀县| 马龙县| 织金县| 平昌县| 天全县| 梁河县| 涿鹿县| 高清| 包头市| 晋宁县| 剑阁县| 莱州市| 乐清市| 阳西县| 阳高县| 景东| 淅川县| 扎兰屯市| 黑龙江省| 绥德县| 嵩明县| 濉溪县| 藁城市| 宜宾县| 达尔|