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

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")
主站蜘蛛池模板: 本溪市| 盐源县| 贵阳市| 河西区| 澄城县| 仪征市| 聊城市| 两当县| 唐海县| 建平县| 德令哈市| 永康市| 千阳县| 托克托县| 迭部县| 七台河市| 炉霍县| 廊坊市| 界首市| 长垣县| 上杭县| 贡山| 安丘市| 绵阳市| 加查县| 元江| 罗定市| 泸州市| 奎屯市| 石景山区| 响水县| 彰武县| 柘城县| 乡城县| 盐边县| 临澧县| 安溪县| 无锡市| 牡丹江市| 竹溪县| 法库县|