load_data.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Behavior 作者: danustc 项目源码 文件源码
def parse_xls(fpath):
    '''
    load the xls data.
    export: a data frame (in pandas)
    '''
    book = xlrd.open_workbook(fpath)
    sheet_names = book.sheet_names()
    print("sheet_names:", sheet_names)
    xl_sheet = book.sheet_by_name(sheet_names[0])
    title_row = xl_sheet.row_values(0) # title row
    print(title_row)
    xls_file = pd.ExcelFile(fpath)
    sht1 = xls_file.sheet_names[0]
    df = xls_file.parse(sht1)
    print(df.ix[0])
    print(df.ix[1])
    print(df[3:])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号