table.py 文件源码

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

项目:IgDiscover 作者: NBISweden 项目源码 文件源码
def fix_columns(df):
    """
    Changes DataFrame in-place
    """
    # Convert all string columns to str to avoid a PerformanceWarning
    for col in _STRING_COLUMNS:
        if col not in df:
            continue
        df[col].fillna('', inplace=True)
        df[col] = df[col].astype('str')
        # Empty strings have been set to NaN by read_csv. Replacing
        # by the empty string avoids problems with groupby, which
        # ignores NaN values.
    # Columns that have any NaN values in them cannot be converted to
    # int due to a numpy limitation.
    for col in _INTEGER_COLUMNS:
        if col not in df.columns:
            continue
        if all(df[col].notnull()):
            df[col] = df[col].astype(int)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号