0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pandasのread_csvでフォルダ内のcsvを読み込む方法

Posted at

解決したい事象

pandasのread_csvメソッドで、フォルダ内のcsvを選択したい

方法

絶対パスを書いても、エラーが発生するため、pyファイルがある階層以降のパスを記載する。

#間違い
train = pd.read_csv("/Hoge/hogehouse-prices-advanced-regression-techniques/train.csv")

#正解
train = pd.read_csv("house-prices-advanced-regression-techniques/train.csv")

はじめにスラッシュ(/)を使わない点もポイント。

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?