Skip to main content

How to read a JA Bank transaction CSV file into Pandas in Python


Transactions in a JA Bank account are available for download as a CSV file. Then Pandas reads it for processing.

Which encoding should I use? If I open the CSV file with macOS app TextMate, it automatically selects the encoding: Japanese - SHIFT JIS.

So I try:

df = pd.read_csv(file_name, encoding="shift_jis")

A raw numerical value in the CSV file is:


But Pandas would read it as:


According to this post, there are multiple encodings for Japanese. I tried both cp932 and shift_jis_2004. The former has the same incorrect result. But the latter one works:


This is the working code:

df = pd.read_csv(file_name, encoding="shift_jis_2004")