def sav_pandas(fp):
    """Read and convert a .sav file to a .csv file via pspp, then convert that to JSON format
    using the pandas library

    :param fp: File pointer object
    :return: tuple of table headers and data
    """
    csv_file = sav_to_csv(fp)
    dataframe = pandas.read_csv(csv_file.name, low_memory=False)
    return data_from_dataframe(dataframe)
示例#2
0
def sav_pandas(fp):
    """Read and convert a .sav file to a .csv file via pspp, then convert that to JSON format
    using the pandas library

    :param fp: File pointer object
    :return: tuple of table headers and data
    """
    csv_file = sav_to_csv(fp)
    dataframe = pandas.read_csv(csv_file.name, low_memory=False)
    return data_from_dataframe(dataframe)
def sav_stdlib(fp):
    """Read and convert a .sav file to .csv with pspp, then convert that to JSON format using
    the python standard library

    :param fp: File pointer object to a .sav file
    :return: tuple of table headers and data
    """
    csv_file = utilities.sav_to_csv(fp)
    with open(csv_file.name, 'r') as file:
        csv_file.close()
        return csv_stdlib(file)
def sav_stdlib(fp):
    """Read and convert a .sav file to .csv with pspp, then convert that to JSON format using
    the python standard library

    :param fp: File pointer object to a .sav file
    :return: tuple of table headers and data
    """
    csv_file = utilities.sav_to_csv(fp)
    with open(csv_file.name, 'r') as file:
        csv_file.close()
        return csv_stdlib(file)