简体   繁体   中英

Iterate row csv file using pandas, python

How can I iterate over my second row of an csv file using pandas? I have a csv file like

;Fund Code;Date;Security ID

0;BOOY;10/23/2015;906

1;BOOY;10/23/2015;932

1;BOOY;10/23/2015;931

I want to print the following:

0
BODY
10/23/2015
906

I am not sure that this is what you want. It seems you want to print only the first line of your csv (excluding the header). If so, this is as simple as:

import pandas 
from pandas import *

df = pd.read(path_to_your_file)

df.head(1) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM