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

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")
主站蜘蛛池模板: 青田县| 胶南市| 永济市| 唐海县| 吉木萨尔县| 亚东县| 新乡县| 南郑县| 石狮市| 忻城县| 逊克县| 上林县| 麻阳| 盐城市| 罗山县| 揭阳市| 历史| 梧州市| 鄂温| 平定县| 嫩江县| 海兴县| 青冈县| 南和县| 新晃| 金沙县| 全州县| 余江县| 湾仔区| 乌什县| 安宁市| 十堰市| 阳城县| 安泽县| 白玉县| 舞钢市| 成安县| 年辖:市辖区| 四平市| 蒲江县| 彭水|