§
<ˆj�’ ã ó" — d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z
dd lmZ dd
l
mZ ddlmZ g d¢Ze
j Zd
ddd
ddddd
ddddddœZej Zd„ Z ed¦ « G d„ d¦ « ¦ « Z G d„ dej ¦ « Z G d„ de¦ « Zd„ Z ed¦ « d%d„¦ « Z ed¦ « d%d„¦ « Z ed¦ « d&d „¦ « Zd!„ Z ed¦ « d&d"„¦ « Z ed¦ « d'd$„¦ « Z!dS )(a‚
Record Arrays
=============
Record arrays expose the fields of structured arrays as properties.
Most commonly, ndarrays contain elements of a single type, e.g. floats,
integers, bools etc. However, it is possible for elements to be combinations
of these using structured types, such as::
>>> a = np.array([(1, 2.0), (1, 2.0)], dtype=[('x', np.int64), ('y', np.float64)])
>>> a
array([(1, 2.), (1, 2.)], dtype=[('x', '>> a['x']
array([1, 1])
>>> a['y']
array([2., 2.])
Record arrays allow us to access fields as properties::
>>> ar = np.rec.array(a)
>>> ar.x
array([1, 1])
>>> ar.y
array([2., 2.])
é N)ÚCounter)Únullcontexté )Ú
set_moduleé )Únumeric)Únumerictypes)Ú os_fspath)Ú_get_legacy_print_mode)ÚrecordÚrecarrayÚ
format_parserÚ
fromarraysÚfromrecordsÚ
fromstringÚfromfileÚarrayú>ú<ú=Úsú|)ÚbÚlÚnÚBÚLÚNÚSr r r r r ÚIÚic óX — d„ t | ¦ « ¦ « D ¦ « S )z@Find duplication in a list, return a list of duplicated elementsc ó$ — g | ]
\ }}|d k ¯|‘ŒS ©r © )Ú.0ÚitemÚcountss úI/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/core/records.pyú
z"find_duplicate..P s- € ð ð ð áˆD�&Ø�AŠ:ˆ:ð
àˆ:ˆ:ó )r Úitems)Úlists r) Úfind_duplicater. N s5 € ðð å# D™MœM×/Ò/Ñ1Ô1ðñ ô ð r+ Únumpyc ó. — e Zd ZdZdd„Zd d„Zd„ Zd„ ZdS )
r a‡
Class to convert formats, names, titles description to a dtype.
After constructing the format_parser object, the dtype attribute is
the converted data-type:
``dtype = format_parser(formats, names, titles).dtype``
Attributes
----------
dtype : dtype
The converted data-type.
Parameters
----------
formats : str or list of str
The format description, either specified as a string with
comma-separated format descriptions in the form ``'f8, i4, a5'``, or
a list of format description strings in the form
``['f8', 'i4', 'a5']``.
names : str or list/tuple of str
The field names, either specified as a comma-separated string in the
form ``'col1, col2, col3'``, or as a list or tuple of strings in the
form ``['col1', 'col2', 'col3']``.
An empty list can be used, in that case default field names
('f0', 'f1', ...) are used.
titles : sequence
Sequence of title strings. An empty list can be used to leave titles
out.
aligned : bool, optional
If True, align the fields by padding as the C-compiler would.
Default is False.
byteorder : str, optional
If specified, all the fields will be changed to the
provided byte-order. Otherwise, the default byte-order is
used. For all available string specifiers, see `dtype.newbyteorder`.
See Also
--------
dtype, typename, sctype2char
Examples
--------
>>> np.format_parser(['>> np.format_parser(['f8', 'i4', 'a5'], ['col1', 'col2', 'col3'],
... []).dtype
dtype([('col1', '>> np.format_parser(['