def make_series(x, *args, **kwargs):
if isinstance(x, pd.Series):<EOL><INDENT>return x<EOL><DEDENT>try:<EOL><INDENT>if len(args) == <NUM_LIT:1> and '<STR_LIT>' not in args:<EOL><INDENT>args = ['<STR_LIT>'] + list(args)<EOL><DEDENT>df = pd.DataFrame.from_records(getattr(x, '<STR_LIT>', x).values(*args))<EOL>if len(df.columns) == <NUM_LIT:1>:<EOL><INDENT>return df[df.columns[<NUM_LIT:0>]]<EOL><DEDENT>elif len(df.columns) >= <NUM_LIT:2>:<EOL><INDENT>return df.set_index(df.columns[<NUM_LIT:0>], drop=False)[df.columns[<NUM_LIT:1>]]<EOL><DEDENT>logger.warn('<STR_LIT>'.format(x, args, kwargs))<EOL>return pd.Series()<EOL><DEDENT>except (AttributeError, TypeError):<EOL><INDENT>kwargs['<STR_LIT:name>'] = getattr(x, '<STR_LIT:name>', None) if '<STR_LIT:name>' not in kwargs else kwargs['<STR_LIT:name>']<EOL>if '<STR_LIT:index>' in kwargs:<EOL><INDENT>x = list(x)<EOL><DEDENT>try:<EOL><INDENT>return pd.Series(x, **kwargs)<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>logger.debug(format_exc())<EOL>try:<EOL><INDENT>return pd.Series(np.array(x), **kwargs)<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>logger.debug(format_exc())<EOL>return pd.Series(x, **kwargs)<EOL><DEDENT><DEDENT><DEDENT>
Coerce a provided array/sequence/generator into a pandas.Series object
    FIXME: Deal with CSR, COO, DOK and other sparse matrices like this:
       pd.Series(csr.toarray()[:,0])
         or, if csr.shape[1] == 2
       pd.Series(csr.toarray()[:,1], index=csr.toarray()[:,0])
    >>> make_series(range(1, 4))
    0    1
    1    2
    2    3
    dtype: int64
    >>> make_series(range(1, 4))
    0    1
    1    2
    2    3
    dtype: int64
    >>> make_series(list('ABC'))
    0    A
    1    B
    2    C
    dtype: object
    >>> make_series({'a': .8, 'be': .6}, name=None)
    a     0.8
    be    0.6
    dtype: float64