Python Pandas dataframe reading exact specified range in an excel sheet

后端 未结 3 1173
北海茫月
北海茫月 2020-12-28 19:17

I have a lot of different table (and other unstructured data in an excel sheet) .. I need to create a dataframe out of range \'A3:D20\' from \'Sheet2\' of Excel sheet \'data

3条回答
  •  [愿得一人]
    2020-12-28 19:50

    my answer with pandas O.25 tested and worked well

    pd.read_excel('resultat-elections-2012.xls', sheet_name = 'France entière T1T2', skiprows = 2,  nrows= 5, usecols = 'A:H')
    pd.read_excel('resultat-elections-2012.xls', index_col = None, skiprows= 2, nrows= 5, sheet_name='France entière T1T2', usecols=range(0,8))
    

    So : i need data after two first lines ; selected desired lines (5) and col A to H.
    Be carefull @shane answer's need to be improved and updated with the new parameters of Pandas

    my original excel

    my process with pandas read_excel

提交回复
热议问题