o
    0Gfu                     @   s$  d dl mZ d dlZd dlmZmZ d dlZd dl	m
Z
mZmZmZ g dZeejZeedk Zeedk Zeedk Zeed	k Zeed
k Zzd dlmZ W n ey`   d dlmZ Y nw zd dlmZ W n eyx   d dlmZ Y nw ejejfZzd dl m!Z! W n ey   d dl"m#  m!Z! Y nw e!j$Z$e!j%Z%e!j&Z&dej'de(fddZ)dej'de(fddZ*zd dl+m,Z- W n ey   d dl.Z.d+ddZ/dd Z-Y nw dejdej0fddZ1dd Z2dd  Z3dee4 fd!d"Z5erd#nd$Z6erd%nd&Z7erd'nd(Z8eri Z9dS d)d*iZ9dS ),    )OptionalN)Versionparse)AppenderSubstitutioncache_readonlydeprecate_kwarg)assert_frame_equalassert_index_equalassert_series_equaldata_klassesfrequenciesis_numeric_dtypetestingr   r   r   r   is_int_indexis_float_indexmake_dataframeto_numpyPD_LT_1_0_0get_cached_funcget_cached_doccall_cached_func	PD_LT_1_4PD_LT_2	MONTH_ENDQUARTER_ENDYEAR_ENDFUTURE_STACKz2.1.99z2.0.99z0.99.0z1.3.99z1.9.99)r   )offsets)r   indexreturnc                 C   *   t | tjot | jtjot| jtjS )z
    Check if an index is integral

    Parameters
    ----------
    index : pd.Index
        Any numeric index

    Returns
    -------
    bool
        True if is an index with a standard integral type
    )
isinstancepdIndexdtypenp
issubdtypeZintegerr    r)   9lib/python3.10/site-packages/statsmodels/compat/pandas.pyr   G   
   r   c                 C   r!   )z
    Check if an index is floating

    Parameters
    ----------
    index : pd.Index
        Any numeric index

    Returns
    -------
    bool
        True if an index with a standard numpy floating dtype
    )r"   r#   r$   r%   r&   r'   Zfloatingr(   r)   r)   r*   r   \   r+   r   )makeDataFrameOc                 C   sb   t jttjtj t jdfd}t jj|| t 	| d
t j| f|}|du r,|S ||S )z4
        Generate an array of byte strings.
           )r%   )sizeN)r&   ZarrayliststringZascii_lettersdigitsZstr_randomchoiceZprodviewZreshapeZastype)ncharsr/   r%   Zrands_charsZretvalr)   r)   r*   rands_arrayv   s   
r7   c                     sF   dd} t jtdddd  fddtjd|  D }t |S )	z@
        Simple verion of pandas._testing.makeDataFrame
              
   )r6   r/   N)namec                    s$   i | ]}|t jtj d qS )r(   )r#   Seriesr&   r3   Zrandn).0cr   nr)   r*   
<dictcomp>   s    z"make_dataframe.<locals>.<dictcomp>)r#   r$   r7   r1   Zascii_uppercase	DataFrame)kdatar)   r?   r*   r      s   
r   poc                 C   s$   z|   W S  ty   | j Y S w )z
    Workaround legacy pandas lacking to_numpy

    Parameters
    ----------
    po : Pandas obkect

    Returns
    -------
    ndarray
        A numpy array
    )r   AttributeErrorvalues)rE   r)   r)   r*   r      s
   

r   c                 C   s"   z| j W S  ty   | j Y S w N)fgetrF   funccached_propr)   r)   r*   r      s
   
r   c                 O   s   t | }||i |S rH   )r   )rL   argskwargsfr)   r)   r*   r      s   r   c                 C   s
   t | jS rH   )r   __doc__rK   r)   r)   r*   r      s   
r   MZMEQZQEYZYEZfuture_stackT)r-   ):typingr   Znumpyr&   Zpackaging.versionr   r   Zpandasr#   Zpandas.util._decoratorsr   r   r   r   __all____version__versionZPD_LT_2_2_0ZPD_LT_2_1_0r   r   r   Zpandas.api.typesr   ImportErrorZpandas.core.commonZpandas.tseriesr   r   r<   rB   r   Zpandas.testingr   Zpandas.util.testingutilr	   r
   r   r$   boolr   r   Zpandas._testingr,   r   r1   r7   Zndarrayr   r   r   strr   r   r   r   r   r)   r)   r)   r*   <module>   s`    

#