I am trying to use the skiprows in pandas pd.read_csv function, however when I use it I only get that specific row from where it should start.
I.e. skiprows=1, will ONLY output row 1.
Any idea why this is happening.
I am loading the CSV file in like this:
df = pd.read_csv(filename, usecols=cols,skiprows=4,nrows=10)
The following is a snapshot of my df, which as per the above example should give me Canada-Italy:
iyear country_txt y x count code
0 1970 Argentina 4 0 15 ARG
1 1970 Australia 0 0 0 AUS
2 1970 Belgium 0 0 0 BEL
3 1970 Brazil 2 0 5 BRA
4 1970 Canada 1 0 1 CAN
5 1970 Colombia 0 0 0 COL
6 1970 Dominican Republic 1 0 1 DOM
7 1970 Germany 0 0 9 DEU
8 1970 Egypt 0 2 0 EGY
9 1970 Greece 2 0 2 GRC
10 1970 Guatemala 2 0 2 GTM
11 1970 Iran 0 0 4 IRN
12 1970 Ireland 1 0 0 IRL
13 1970 Israel 1 0 0 ISR
14 1970 Italy 0 0 1 ITA
15 1970 Japan 0 0 1 JPN
16 1970 Jordan 1 0 6 JOR
17 1970 Lebanon 0 0 0 LBN
18 1970 Mexico 0 0 1 MEX
19 1970 Netherlands 0 0 1 NLD
20 1970 Nicaragua 0 0 0 NIC
21 1970 Pakistan 1 0 0 PAK
22 1970 Paraguay 1 1 0 PRY
23 1970 Philippines 5 0 7 PHL
24 1970 Spain 0 0 2 ESP
25 1970 Switzerland 47 0 2 CHE
26 1970 Turkey 0 0 9 TUR
27 1970 United Kingdom 20 0 7 GBR
28 1970 United States 33 0 364 USA
29 1970 Uruguay 2 0 22 URY
30 1970 Venezuela 0 0 1 VEN
However the output is the following:
Empty DataFrame
Columns: [1970, Brazil, 2, 0, 5, BRA]
Index: []