관리-도구
편집 파일: mrecords.cpython-37.pyc
B ��Fdk � @ sh d Z ddlmZmZmZ ddlZddlZddlZddl m mZ ddl mZ ddlmZmZmZmZmZ ddlmZmZ ej jjZejZddlmZ ddlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& ej j'Z'dd d ddd gZ(ddddgZ)dd� Z*d&dd�Z+dd� Z,G dd� de e-�Z.dd� Z/e.Z0d'dd �Zdddddddde"f dd�Zdd� Z1d d!� Z2d(d$d�Z3d)d%d �Z4dS )*a, :mod:`numpy.ma..mrecords` Defines the equivalent of :class:`numpy.recarrays` for masked arrays, where fields can be accessed as attributes. Note that :class:`numpy.ma.MaskedArray` already supports structured datatypes and the masking of individual fields. .. moduleauthor:: Pierre Gerard-Marchant � )�division�absolute_import�print_functionN)� basestring)�bool_�dtype�ndarray�recarray�array)� fromarrays�fromrecords)�MAError�MaskedArray�masked�nomask�masked_array�getdata�getmaskarray�filled� MaskedRecords� mrecarrayr r �fromtextfile�addfield�_data�_mask� _fieldmaskr c C s� t | d�r"d�dd� | jjD ��S d}xL| D ]D}t�|�}|t|jj 7 }t|jjt j �rh|t|j�7 }|d7 }q,W |dd� S )zR Returns the formats of arrays in arraylist as a comma-separated string. r �,c S s g | ]}|d �qS )� � )�.0�descr r �D/opt/alt/python37/lib64/python3.7/site-packages/numpy/ma/mrecords.py� <listcomp>9 s z_getformats.<locals>.<listcomp>� N���) �hasattr�joinr �descr�np�asarray�_typestr�type� issubclass�ntypesZflexible�repr�itemsize)�data�formats�objr r r! �_getformats3 s r3 c C s� t | �}dd� t|�D �}|dkr(|}nZt|ttf�r<|}n&t|t�rR|�d�}ntdt|� ��t |�}||k r�|||d� 7 }g }xbt ||| j �D ]P\}}}|tkr�|d tkr�|�||d f� q�|�|� q�|�||d f� q�W t �|�S )z� Checks that field names ``descr`` are not reserved keywords. If this is the case, a default 'f%i' is substituted. If the argument `names` is not None, updates the field names to valid names. c S s g | ]}d | �qS )zf%ir )r �ir r r! r"