首先需要用pip 安裝pandas、 xlrd、openpyxl,然後直接貼代碼
import pandas as pd
data_path = 'E:/pythonProject/python_pandas/test_pandas.xlsx' //此處爲excel表的路徑
data = pd.read_excel(data_path)
data.loc[0,'ground_time'] = '888' //0代表第一行,‘ground_time’是列名
data.to_excel(data_path, index=None)
print(data)
獲取列數
data.shape[1]
獲取行數
data.shape[0]
or
len(data)