Skip to content

Instantly share code, notes, and snippets.

@ochilab
Last active February 25, 2019 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ochilab/e51f5c713fb190597834aa2873bc6cc2 to your computer and use it in GitHub Desktop.
Save ochilab/e51f5c713fb190597834aa2873bc6cc2 to your computer and use it in GitHub Desktop.
CSV形式のファイル読み込み。文字コードを指定する場合の使い分け
import codecs
import pandas as pd
recordFile=""
#UTF-8のCSVファイルを読む場合
alldata = pd.read_csv(recordFile)
#Shift-JISのCSVファイルを読む場合
with codecs.open(recordFile, "r", "Shift-JIS", "ignore") as file:
alldata = pd.read_table(file, delimiter=",")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment