17 lines
411 B
Python
17 lines
411 B
Python
import pandas as pd
|
|
|
|
# 讀取 Excel 檔案
|
|
file_path = "c:\\AI_Program\\C0908\\Data\\pizza.xlsx"
|
|
|
|
def read_excel():
|
|
try:
|
|
# 使用 pandas 讀取 Excel
|
|
data = pd.read_excel(file_path)
|
|
print("資料內容:")
|
|
print(data.head())
|
|
return data
|
|
except Exception as e:
|
|
print(f"讀取 Excel 檔案時發生錯誤: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
read_excel() |