我正在撰寫一個程式,盡管我用 Pandas 發布了絕對檔案路徑,但 Python 無法讀取我的檔案。最奇怪的是,這個程式以前可以運行,但現在不行,我也想不通為什么。這是程式和錯誤:
import pandas as pd
df = pd.read_csv(r"C:\Users\user\Desktop\Small_businesses1",encoding='latin1')
錯誤:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\Desktop\\Small_businesses1'
該檔案肯定在那個位置,我復制粘貼了該位置!任何修復將不勝感激
uj5u.com熱心網友回復:
好像你省略了檔案型別后綴試試
df = pd.read_csv(r"C:\Users\user\Desktop\Small_businesses1.csv",encoding='latin1')
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/348993.html
上一篇:基本的python計算器
