(values, categories=None, ordered=None, dtype=None, fastpath=False)
return impl
Implementation of constructor for pandas Categorical via objmode.
Implementation of constructor for pandas Categorical via objmode.
Implementation of constructor for pandas Categorical via objmode .
def _Categorical(values, categories=None, ordered=None, dtype=None, fastpath=False):
    """
    Implementation of constructor for pandas Categorical via objmode.
    """
    # TODO: support other parameters (only values now)

    ty = typeof(_reconstruct_Categorical(values))

    from textwrap import dedent
    text = dedent(f"""
    def impl(values, categories=None, ordered=None, dtype=None, fastpath=False):
        with objmode(categorical="{ty}"):
            categorical = pd.Categorical(values, categories, ordered, dtype, fastpath)
        return categorical
    """)
    globals, locals = {'objmode': objmode, 'pd': pd}, {}
    exec(text, globals, locals)
    impl = locals['impl']
    return impl
def _Categorical ( values , categories = None , ordered = None , dtype = None , fastpath = False ) : # TODO: support other parameters (only values now) ty = typeof ( _reconstruct_Categorical ( values ) ) from textwrap import dedent text = dedent ( f"""
    def impl(values, categories=None, ordered=None, dtype=None, fastpath=False):
        with objmode(categorical="{ty}"):
            categorical = pd.Categorical(values, categories, ordered, dtype, fastpath)
        return categorical
    """ ) globals , locals = { 'objmode' : objmode , 'pd' : pd } , { } exec ( text , globals , locals ) impl = locals [ 'impl' ] return impl