Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pandas/core/__pycache__/flags.cpython-37.pyc
Назад
B �5�g� � @ s d dl Z G dd� d�ZdS )� Nc @ sd e Zd ZdZdhZdd� Zeed�dd��Zej ed�d d��Zd d� Z dd � Zdd� Zdd� 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_labelsc C s || _ t�|�| _d S )N)�_allows_duplicate_labels�weakref�ref�_obj)�self�objr � r �G/home/digitalm-up/venv/lib/python3.7/site-packages/pandas/core/flags.py�__init__/ s zFlags.__init__)�returnc C s | j S )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.allows_duplicate_labels True >>> df.allows_duplicate_labels = False Traceback (most recent call last): ... pandas.errors.DuplicateLabelError: Index has duplicates. positions label a [0, 1] )r )r r r r r 3 s zFlags.allows_duplicate_labels)�valuec C sF t |�}| �� }|d kr td��|s<x|jD ]}|�� q,W || _d S )Nz$This flag's object has been deleted.)�boolr � ValueErrorZaxesZ_maybe_check_uniquer )r r r Zaxr r r r S s c C s || j krt|��t| |�S )N)�_keys�KeyError�getattr)r �keyr r r �__getitem__` s zFlags.__getitem__c C s0 || j kr td|� d| j � ���t| ||� d S )Nz Unknown flag z. Must be one of )r r �setattr)r r r r r r �__setitem__f s zFlags.__setitem__c C s d| j � d�S )Nz<Flags(allows_duplicate_labels=z)>)r )r r r r �__repr__k s zFlags.__repr__c C s t |t| ��r| j|jkS dS )NF)� isinstance�typer )r �otherr r r �__eq__n s zFlags.__eq__N)�__name__� __module__�__qualname__�__doc__r r �propertyr r �setterr r r r r r r r r s 'r )r r r r r r �<module> s
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Генерация страницы: 0.05 |
proxy
|
phpinfo
|
Настройка