kmj_lincs /lincs/io/stats.py

Language Python Lines 20
MD5 Hash ec2c4d413b59c97baf406b7cd0012539 Estimated Cost $215 (why?)
Repository https://bitbucket.org/kljensen/kmj_lincs.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import pandas


def read_data_file(path, sheet_name, signals, cell_count_col):
    """ Reads an Excel file into a pandas DataFrame and deletes
        all columns that aren't either a signal intensity or
        the cell_count_col.
    """
    xls_file = pandas.ExcelFile(path)
    data = xls_file.parse(sheet_name)
    cols_to_keep = set(signals + [cell_count_col])
    for col in data.columns:
        if col not in cols_to_keep:
            del data[col]

    # Make sure the cell_count_col is always "cell_count"
    #
    data.rename(columns={cell_count_col: "cell_count"}, inplace=True)
    return data
Back to Top