@@ -47,9 +47,6 @@ class DateConversionError(Exception):
47
47
skiprows : list-like or integer
48
48
Row numbers to skip (0-indexed) or number of rows to skip (int)
49
49
at the start of the file
50
- skip_footer : int, default 0
51
- Lines at bottom of file to skip. If >0 then indicates the row to start
52
- skipping. If <0 then skips the specified number of rows from the end.
53
50
index_col : int or sequence, default None
54
51
Column to use as the row labels of the DataFrame. If a sequence is
55
52
given, a MultiIndex is used.
@@ -85,6 +82,8 @@ class DateConversionError(Exception):
85
82
Return TextParser object
86
83
chunksize : int, default None
87
84
Return TextParser object for iteration
85
+ skip_footer : int, default 0
86
+ Number of line at bottom of file to skip
88
87
converters : dict. optional
89
88
Dict of functions for converting values in certain columns. Keys can either
90
89
be integers or column labels
@@ -478,7 +477,7 @@ def __init__(self, f, delimiter=None, dialect=None, names=None, header=0,
478
477
else :
479
478
self .converters = {}
480
479
481
- # assert(self.skip_footer >= 0)
480
+ assert (self .skip_footer >= 0 )
482
481
483
482
self .keep_default_na = keep_default_na
484
483
if na_values is None and keep_default_na :
@@ -783,10 +782,8 @@ def _rows_to_cols(self, content):
783
782
footers = 0
784
783
if self .skip_footer :
785
784
footers = self .skip_footer
786
- if footers > 0 :
787
- footers = footers - self .pos
788
- row_num = self .pos - (len (content ) - i - footers )
789
785
786
+ row_num = self .pos - (len (content ) - i + footers )
790
787
msg = ('Expecting %d columns, got %d in row %d' %
791
788
(col_len , zip_len , row_num ))
792
789
raise ValueError (msg )
@@ -1108,7 +1105,7 @@ def _get_lines(self, rows=None):
1108
1105
self .buf = []
1109
1106
1110
1107
if self .skip_footer :
1111
- lines = lines [:self .skip_footer ]
1108
+ lines = lines [:- self .skip_footer ]
1112
1109
1113
1110
lines = self ._check_comments (lines )
1114
1111
return self ._check_thousands (lines )
0 commit comments