以下の例では、空の配列 data を用意しておき、最初の3行を読み込んでおく。
例
import csv
with open('data.csv','r') as csv_file:
csv_reader = csv.reader(csv_file)
data = []
for row in csv_reader:
data.append(row)
for row in data[:3]:
print(row)
data.csv
"2021/01/10 02:34:10","JPY","買い","1,713.12"
"2022/03/08 12:20:32","USD","売り","9876"
"2022/12/31 18:07:55","EUR","買い","1,234,888.9"
"2022/12/31 18:07:55","EUR","買い","1,111.9"
"2022/12/31 20:08:55","EUR","買い","10"
"2023/03/31 18:07:55","USD","売り","34,888"
"2023/04/01 08:17:55","USD","売り","34,888"
"2023/05/10 09:24:05","USD","売り","34,888"
結果
['2021/01/10 02:34:10', 'JPY', '買い', '1,713.12']
['2022/03/08 12:20:32', 'USD', '売り', '9876']
['2022/12/31 18:07:55', 'EUR', '買い', '1,234,888.9']