utils.py 文件源码

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

项目:bedrock-core 作者: Bedrock-py 项目源码 文件源码
def loadMatrix(filepath):
    """
    use pandas to load the csv file into the dataframe,
    using a header if appropriate
    """
    with open(filepath, 'rbU') as csvfile:
        snippet = csvfile.read(2048)
        sniffer = csv.Sniffer()
        dialect = sniffer.sniff(snippet)
    if sniffer.has_header(snippet):
        df = pd.read_csv(filepath, dialect=dialect)
    else:
        df = pd.read_csv(filepath, dialect=dialect, header=None)

    return df
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号