# Path: econtools/util/frametools.py
# def df_to_list(df: Union[list, pd.DataFrame]) -> list:
#     """ Turn rows of DataFrame to list of Series objects """
#     if isinstance(df, list):
#         return df
#     elif isinstance(df, pd.DataFrame):
#         return [b for a, b in df.iterrows()]
#     else:
#         raise ValueError


import argparse
import re
import warnings
import numpy as np
import pandas as pd
                    import sys
from datetime import datetime
from functools import wraps
from inspect import getfullargspec
from os.path import isfile, splitext
from typing import Optional, Callable, List, Tuple
from econtools.util.frametools import df_to_list

    if listin:
        output = _parse_list_input(ans, dtype)
        set_ans = set(output)
        good = set_ans <= set(good_answers)
    else:
        output = ans
        good = ans in good_answers

    if not good and _count < 4:
        print("Invalid Response '{}'!".format(ans))
        _count += 1
        output = force_valid_response(prompt_str, good_answers, listin=listin,
                                      dtype=dtype, _count=_count)
    elif not good:
        raise ValueError('Learn to read')

    return output

def _parse_list_input(inp, dtype):
    inp = re.sub(r'\s\s+', ' ', inp)
    list_inp = inp.split(' ')
    if dtype:
        list_inp = map(dtype, list_inp)
    return list_inp


class DataInteractModel(object):

    def __init__(self, looplist, **kwargs):

# Path: econtools/util/frametools.py
# def df_to_list(df: Union[list, pd.DataFrame]) -> list:
#     """ Turn rows of DataFrame to list of Series objects """
#     if isinstance(df, list):
#         return df
#     elif isinstance(df, pd.DataFrame):
#         return [b for a, b in df.iterrows()]
#     else:
#         raise ValueError


# Path: econtools/util/io.py
import argparse
import re
import warnings
import numpy as np
import pandas as pd
                    import sys
from datetime import datetime
from functools import wraps
from inspect import getfullargspec
from os.path import isfile, splitext
from typing import Optional, Callable, List, Tuple
from econtools.util.frametools import df_to_list


    if listin:
        output = _parse_list_input(ans, dtype)
        set_ans = set(output)
        good = set_ans <= set(good_answers)
    else:
        output = ans
        good = ans in good_answers

    if not good and _count < 4:
        print("Invalid Response '{}'!".format(ans))
        _count += 1
        output = force_valid_response(prompt_str, good_answers, listin=listin,
                                      dtype=dtype, _count=_count)
    elif not good:
        raise ValueError('Learn to read')

    return output

def _parse_list_input(inp, dtype):
    inp = re.sub(r'\s\s+', ' ', inp)
    list_inp = inp.split(' ')
    if dtype:
        list_inp = map(dtype, list_inp)
    return list_inp


class DataInteractModel(object):

    def __init__(self, looplist, **kwargs):

        self.looplist = df_to_list(looplist)