1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
U
¬ý°d±ã@s&ddlmZddlZGdd„dƒZdS)é)Ú annotationsNc@sxeZdZdZdhZddœdd„Zeddœdd    „ƒZejddd
œd d    „ƒZd d „Z    ddœdd„Z
ddœdd„Z dd„Z dS)ÚFlagsa)
    Flags that apply to pandas objects.
 
    .. versionadded:: 1.2.0
 
    Parameters
    ----------
    obj : Series or DataFrame
        The object these flags are associated with.
    allows_duplicate_labels : bool, default True
        Whether to allow duplicate labels in this object. By default,
        duplicate labels are permitted. Setting this to ``False`` will
        cause an :class:`errors.DuplicateLabelError` to be raised when
        `index` (or columns for DataFrame) is not unique, or any
        subsequent operation on introduces duplicates.
        See :ref:`duplicates.disallow` for more.
 
        .. warning::
 
           This is an experimental feature. Currently, many methods fail to
           propagate the ``allows_duplicate_labels`` value. In future versions
           it is expected that every method taking or returning one or more
           DataFrame or Series objects will propagate ``allows_duplicate_labels``.
 
    Notes
    -----
    Attributes can be set in two ways
 
    >>> df = pd.DataFrame()
    >>> df.flags
    <Flags(allows_duplicate_labels=True)>
    >>> df.flags.allows_duplicate_labels = False
    >>> df.flags
    <Flags(allows_duplicate_labels=False)>
 
    >>> df.flags['allows_duplicate_labels'] = True
    >>> df.flags
    <Flags(allows_duplicate_labels=True)>
    Úallows_duplicate_labelsÚNone)ÚreturncCs||_t |¡|_dS©N)Ú_allows_duplicate_labelsÚweakrefÚrefÚ_obj)ÚselfÚobjr©rúHd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/core/flags.pyÚ__init__1szFlags.__init__ÚboolcCs|jS)a
        Whether this object allows duplicate labels.
 
        Setting ``allows_duplicate_labels=False`` ensures that the
        index (and columns of a DataFrame) are unique. Most methods
        that accept and return a Series or DataFrame will propagate
        the value of ``allows_duplicate_labels``.
 
        See :ref:`duplicates` for more.
 
        See Also
        --------
        DataFrame.attrs : Set global metadata on this object.
        DataFrame.set_flags : Set global flags on this object.
 
        Examples
        --------
        >>> df = pd.DataFrame({"A": [1, 2]}, index=['a', 'a'])
        >>> df.flags.allows_duplicate_labels
        True
        >>> df.flags.allows_duplicate_labels = False
        Traceback (most recent call last):
            ...
        pandas.errors.DuplicateLabelError: Index has duplicates.
              positions
        label
        a        [0, 1]
        )r©r rrrr5szFlags.allows_duplicate_labels)ÚvaluercCsBt|ƒ}| ¡}|dkr tdƒ‚|s8|jD] }| ¡q*||_dS)Nz$This flag's object has been deleted.)rr Ú
ValueErrorZaxesZ_maybe_check_uniquer)r rr ZaxrrrrUs
 
cCs||jkrt|ƒ‚t||ƒSr)Ú_keysÚKeyErrorÚgetattr)r ÚkeyrrrÚ __getitem__bs
zFlags.__getitem__cCs0||jkr td|›d|j›ƒ‚t|||ƒdS)Nz Unknown flag z. Must be one of )rrÚsetattr)r rrrrrÚ __setitem__hs
zFlags.__setitem__ÚstrcCsd|j›dS)Nz<Flags(allows_duplicate_labels=z)>)rrrrrÚ__repr__mszFlags.__repr__cCst|t|ƒƒr|j|jkSdS)NF)Ú
isinstanceÚtyper)r ÚotherrrrÚ__eq__ps z Flags.__eq__N) Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrÚpropertyrÚsetterrrrr!rrrrrs( r)Ú
__future__rr    rrrrrÚ<module>s