zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
U
¬ý°dËúã@sôUdZddlmZddlZddlmZmZmZmZm    Z    m
Z
m Z m Z m Z mZddlZddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZddl m!Z!ddl"m#Z$dd    l%m&Z&dd
l'm(Z(m)Z)m*Z*dd l+m,Z,m-Z-m.Z.dd l/m0Z0dd l1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9ddl:m;Z;m<Z<m=Z=ddl>m?Z?ddl@mAZAmBZBmCZCddlDmEZEmFZFmGZGmHZHmIZIddlJmKZKddlLmMZMmNZNerœddlmOZOmPZPiZQdeRd<e dddZSGdd„dƒZTGdd„deTƒZUGdd„dƒZVGd d!„d!eVƒZWdS)"z™
An interface for extending pandas with custom arrays.
 
.. warning::
 
   This is an experimental API and subject to breaking changes
   without warning.
é)Ú annotationsN)
Ú TYPE_CHECKINGÚAnyÚCallableÚClassVarÚIteratorÚLiteralÚSequenceÚTypeVarÚcastÚoverload)Úlib) Ú    ArrayLikeÚ    AstypeArgÚAxisIntÚDtypeÚ FillnaOptionsÚPositionalIndexerÚ ScalarIndexerÚSequenceIndexerÚShapeÚSortKindÚ TakeIndexerÚnpt)Úset_function_name)Úfunction©ÚAbstractMethodError)ÚAppenderÚ SubstitutionÚcache_readonly)Úvalidate_bool_kwargÚvalidate_fillna_kwargsÚvalidate_insert_loc)Úmaybe_cast_to_extension_array)Úis_datetime64_dtypeÚis_dtype_equalÚ is_list_likeÚ    is_scalarÚis_timedelta64_dtypeÚ pandas_dtype)ÚExtensionDtype)Ú ABCDataFrameÚABCIndexÚ    ABCSeries©Úisna)Ú    arraylikeÚmissingÚ    roperator)Úfactorize_arrayÚisinÚmodeÚrankÚunique)Úquantile_with_mask)Ú
nargminmaxÚnargsort)Ú NumpySorterÚNumpyValueArrayLikezdict[str, str]Ú_extension_array_shared_docsÚExtensionArrayTÚExtensionArray)Úboundc@sÞeZdZUdZdZedddœdddœdd    „ƒZedddœdddœd
d „ƒZed d „ƒZe    dddœdd„ƒZ
e    ddddœdd„ƒZ
ddddœdd„Z
ddœdd„Z ddœdd „Z d!dœd"d#„Z d$d%dœd&d'„Zdd(d)œd*d+„Zdd(d)œd,d-„Zddejfd.dd$d/d0œd1d2„Zed3dœd4d5„ƒZed6dœd7d8„ƒZeddœd9d:„ƒZeddœd;d<„ƒZeddœd=d>„ƒZe    dÚd@dd/dAœdBdC„ƒZe    dÛd3dddAœdDdC„ƒZe    dÜdEdd(dAœdFdC„ƒZdÝdEdd(dAœdHdC„ZdIdœdJdK„ZeddœdLdM„ƒZd/dœdNdO„ZdGdPdQdRœddSdTd/dUœdVdW„ZdÞdddXœdYdZ„ZdßdddXœd[d\„Z dàdd]d^d_dd`œdadb„Z!dddcœddde„Z"dádd$ddgœdhdi„Z#dddcœdjdk„Z$dâdmdndodpdqœdrds„Z%d$dd)œdtdu„Z&dvdœdwdx„Z'dydœdzd{„Z(dãdd|d}œd~d„Z)d€e*d<e+dd‚e,e*dƒdäddƒd„dd…œd†d‡„ƒƒZ-dddˆœdd‰ddddŠœd‹dŒ„Z.dddcœddŽ„Z/dådd(dœdd‘„Z0dTdœd’d“„Z1dTdœd”d•„Z2dædd–d—œd˜d™„Z3dddšœd›dœ„Z4eddœddž„ƒZ5dçd dd¡œd¢d£„Z6ed¤d¥dd¦œd§d¨„ƒZ7e8ddœd©dª„ƒZ9dGd«œdTddd¬œd­d®„Z:dGd«œdTdd¯œd°d±„Z;d²e<d³<d´dœdµd¶„Z=dddd·œd¸d¹„Z>dddd·œdºd»„Z?dvdd¼œd½d¾„Z@ddvdd¿œdÀdÁ„ZAdTdvddœdÃdĄZBdÅdÆdÇdGddȜdÉdTdTdddȜdÊd˄ZCed6d3d̜dÍd΄ƒZDddÏdTddМdÑd҄ZEdèddddӜdÔdՄZFdÖdTdלdØdلZGdS)ér@aX
    Abstract base class for custom 1-D array types.
 
    pandas will recognize instances of this class as proper arrays
    with a custom type and will not attempt to coerce them to objects. They
    may be stored directly inside a :class:`DataFrame` or :class:`Series`.
 
    Attributes
    ----------
    dtype
    nbytes
    ndim
    shape
 
    Methods
    -------
    argsort
    astype
    copy
    dropna
    factorize
    fillna
    equals
    insert
    isin
    isna
    ravel
    repeat
    searchsorted
    shift
    take
    tolist
    unique
    view
    _accumulate
    _concat_same_type
    _formatter
    _from_factorized
    _from_sequence
    _from_sequence_of_strings
    _reduce
    _values_for_argsort
    _values_for_factorize
 
    Notes
    -----
    The interface includes the following abstract methods that must be
    implemented by subclasses:
 
    * _from_sequence
    * _from_factorized
    * __getitem__
    * __len__
    * __eq__
    * dtype
    * nbytes
    * isna
    * take
    * copy
    * _concat_same_type
 
    A default repr displaying the type, (truncated) data, length,
    and dtype is provided. It can be customized or replaced by
    by overriding:
 
    * __repr__ : A default repr for the ExtensionArray.
    * _formatter : Print scalars inside a Series or DataFrame.
 
    Some methods require casting the ExtensionArray to an ndarray of Python
    objects with ``self.astype(object)``, which may be expensive. When
    performance is a concern, we highly recommend overriding the following
    methods:
 
    * fillna
    * dropna
    * unique
    * factorize / _values_for_factorize
    * argsort, argmax, argmin / _values_for_argsort
    * searchsorted
 
    The remaining methods implemented on this class should be performant,
    as they only compose abstract methods. Still, a more efficient
    implementation may be available, and these methods can be overridden.
 
    One can implement methods to handle array accumulations or reductions.
 
    * _accumulate
    * _reduce
 
    One can implement methods to handle parsing from strings that will be used
    in methods such as ``pandas.io.parsers.read_csv``.
 
    * _from_sequence_of_strings
 
    This class does not inherit from 'abc.ABCMeta' for performance reasons.
    Methods and properties required by the interface raise
    ``pandas.errors.AbstractMethodError`` and no ``register`` method is
    provided for registering virtual subclasses.
 
    ExtensionArrays are limited to 1 dimension.
 
    They may be backed by none, one, or many NumPy arrays. For example,
    ``pandas.Categorical`` is an extension array backed by two arrays,
    one for codes and one for categories. An array of IPv6 address may
    be backed by a NumPy structured array with two fields, one for the
    lower 64 bits and one for the upper 64 bits. Or they may be backed
    by some other storage type, like Python lists. Pandas makes no
    assumptions on how the data are stored, just that it can be converted
    to a NumPy array.
    The ExtensionArray interface does not impose any rules on how this data
    is stored. However, currently, the backing data cannot be stored in
    attributes called ``.values`` or ``._values`` to ensure full compatibility
    with pandas internals. But other names as ``.data``, ``._data``,
    ``._items``, ... can be freely used.
 
    If implementing NumPy's ``__array_ufunc__`` interface, pandas expects
    that
 
    1. You defer by returning ``NotImplemented`` when any Series are present
       in `inputs`. Pandas will extract the arrays and call the ufunc again.
    2. You define a ``_HANDLED_TYPES`` tuple as an attribute on the class.
       Pandas inspect this to determine whether the ufunc is valid for the
       types present.
 
    See :ref:`extending.extension.ufunc` for more.
 
    By default, ExtensionArrays are not hashable.  Immutable subclasses may
    override this behavior.
    Ú    extensionNF©ÚdtypeÚcopyz Dtype | NoneÚboolcCs t|ƒ‚dS)aN
        Construct a new ExtensionArray from a sequence of scalars.
 
        Parameters
        ----------
        scalars : Sequence
            Each element will be an instance of the scalar type for this
            array, ``cls.dtype.type`` or be converted into this type in this method.
        dtype : dtype, optional
            Construct for this particular dtype. This should be a Dtype
            compatible with the ExtensionArray.
        copy : bool, default False
            If True, copy the underlying data.
 
        Returns
        -------
        ExtensionArray
        Nr)ÚclsZscalarsrDrE©rHúNd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/core/arrays/base.pyÚ_from_sequenceñszExtensionArray._from_sequencecCs t|ƒ‚dS)a 
        Construct a new ExtensionArray from a sequence of strings.
 
        Parameters
        ----------
        strings : Sequence
            Each element will be an instance of the scalar type for this
            array, ``cls.dtype.type``.
        dtype : dtype, optional
            Construct for this particular dtype. This should be a Dtype
            compatible with the ExtensionArray.
        copy : bool, default False
            If True, copy the underlying data.
 
        Returns
        -------
        ExtensionArray
        Nr)rGÚstringsrDrErHrHrIÚ_from_sequence_of_stringssz(ExtensionArray._from_sequence_of_stringscCs t|ƒ‚dS)aä
        Reconstruct an ExtensionArray after factorization.
 
        Parameters
        ----------
        values : ndarray
            An integer ndarray with the factorized values.
        original : ExtensionArray
            The original ExtensionArray that factorize was called on.
 
        See Also
        --------
        factorize : Top-level factorize method that dispatches here.
        ExtensionArray.factorize : Encode the extension array as an enumerated type.
        Nr)rGÚvaluesÚoriginalrHrHrIÚ_from_factorizedszExtensionArray._from_factorizedrr)ÚitemÚreturncCsdS©NrH©ÚselfrPrHrHrIÚ __getitem__5szExtensionArray.__getitem__r?r)rTrPrQcCsdSrRrHrSrHrHrIrU9srzExtensionArrayT | AnycCs t|ƒ‚dS)an
        Select a subset of self.
 
        Parameters
        ----------
        item : int, slice, or ndarray
            * int: The position in 'self' to get.
 
            * slice: A slice object, where 'start', 'stop', and 'step' are
              integers or None
 
            * ndarray: A 1-d boolean NumPy ndarray the same length as 'self'
 
            * list[int]:  A list of int
 
        Returns
        -------
        item : scalar or ExtensionArray
 
        Notes
        -----
        For scalar ``item``, return a scalar value suitable for the array's
        type. This should be an instance of ``self.dtype.type``.
 
        For slice ``key``, return an instance of ``ExtensionArray``, even
        if the slice is length 0 or 1.
 
        For a boolean mask, return an instance of ``ExtensionArray``, filtered
        to the values where ``item`` is True.
        NrrSrHrHrIrU=s!ÚNone©rQcCstt|ƒ›dƒ‚dS)a^
        Set one or more values inplace.
 
        This method is not required to satisfy the pandas extension array
        interface.
 
        Parameters
        ----------
        key : int, ndarray, or slice
            When called from, e.g. ``Series.__setitem__``, ``key`` will be
            one of
 
            * scalar int
            * ndarray of integers.
            * boolean ndarray
            * slice object
 
        value : ExtensionDtype.type, Sequence[ExtensionDtype.type], or object
            value or values to be set of ``key``.
 
        Returns
        -------
        None
        z  does not implement __setitem__.N)ÚNotImplementedErrorÚtype)rTÚkeyÚvaluerHrHrIÚ __setitem__`s+zExtensionArray.__setitem__ÚintcCs t|ƒ‚dS)z\
        Length of this array
 
        Returns
        -------
        length : int
        Nr©rTrHrHrIÚ__len__szExtensionArray.__len__z Iterator[Any]ccs tt|ƒƒD]}||Vq dS)z5
        Iterate over elements of the array.
        N)ÚrangeÚlen)rTÚirHrHrIÚ__iter__—szExtensionArray.__iter__Úobjectzbool | np.bool_cCsPt|ƒr@t|ƒr@|jsdS||jjks4t||jjƒr:|jSdSn ||k ¡SdS)z,
        Return for `item in self`.
        FN)    r(r0Ú _can_hold_narDÚna_valueÚ
isinstancerYÚ_hasnaÚanyrSrHrHrIÚ __contains__¡szExtensionArray.__contains__r)ÚotherrQcCs t|ƒ‚dS)zE
        Return for `self == other` (element-wise equality).
        Nr©rTrkrHrHrIÚ__eq__µs
zExtensionArray.__eq__cCs
||kS)zH
        Return for `self != other` (element-wise in-equality).
        rHrlrHrHrIÚ__ne__ÂszExtensionArray.__ne__znpt.DTypeLike | Nonez
np.ndarray)rDrErfrQcCs>tj||d}|s|tjk    r$| ¡}|tjk    r:||| ¡<|S)aI
        Convert to a NumPy ndarray.
 
        This is similar to :meth:`numpy.asarray`, but may provide additional control
        over how the conversion is done.
 
        Parameters
        ----------
        dtype : str or numpy.dtype, optional
            The dtype to pass to :meth:`numpy.asarray`.
        copy : bool, default False
            Whether to ensure that the returned value is a not a view on
            another array. Note that ``copy=False`` does not *ensure* that
            ``to_numpy()`` is no-copy. Rather, ``copy=True`` ensure that
            a copy is made, even if not strictly necessary.
        na_value : Any, optional
            The value to use for missing values. The default value depends
            on `dtype` and the type of the array.
 
        Returns
        -------
        numpy.ndarray
        ©rD)ÚnpÚasarrayr Ú
no_defaultrEr0)rTrDrErfÚresultrHrHrIÚto_numpyÈs 
 zExtensionArray.to_numpyr+cCs t|ƒ‚dS)z2
        An instance of 'ExtensionDtype'.
        Nrr^rHrHrIrDðszExtensionArray.dtypercCs
t|ƒfS)z9
        Return a tuple of the array dimensions.
        )rar^rHrHrIÚshape÷szExtensionArray.shapecCs t |j¡S)z6
        The number of elements in the array.
        )rpÚprodrur^rHrHrIÚsizeþszExtensionArray.sizecCsdS)zH
        Extension Arrays are only allowed to be 1-dimensional.
        érHr^rHrHrIÚndimszExtensionArray.ndimcCs t|ƒ‚dS)zL
        The number of bytes needed to store this object in memory.
        Nrr^rHrHrIÚnbytesszExtensionArray.nbytes.z npt.DTypeLike)rDrErQcCsdSrRrH©rTrDrErHrHrIÚastypeszExtensionArray.astypecCsdSrRrHr{rHrHrIr|srcCsdSrRrHr{rHrHrIr|#sTcCsžt|ƒ}t||jƒr$|s|S| ¡St|tƒrF| ¡}|j|||dSt|ƒrjddl    m
}|j|||dSt |ƒrŽddl    m }|j|||dSt j|||dS)ae
        Cast to a NumPy array or ExtensionArray with 'dtype'.
 
        Parameters
        ----------
        dtype : str or dtype
            Typecode or data-type to which the array is cast.
        copy : bool, default True
            Whether to copy the data, even if not necessary. If False,
            a copy is made only if the old dtype does not match the
            new dtype.
 
        Returns
        -------
        np.ndarray or pandas.api.extensions.ExtensionArray
            An ExtensionArray if dtype is ExtensionDtype,
            Otherwise a NumPy ndarray with 'dtype' for its dtype.
        rCr)Ú DatetimeArray)ÚTimedeltaArray)r*r&rDrErgr+Zconstruct_array_typerJr%Zpandas.core.arraysr}r)r~rpÚarray)rTrDrErGr}r~rHrHrIr|'s 
  z)np.ndarray | ExtensionArraySupportsAnyAllcCs t|ƒ‚dS)aŽ
        A 1-D array indicating if each value is missing.
 
        Returns
        -------
        numpy.ndarray or pandas.api.extensions.ExtensionArray
            In most cases, this should return a NumPy ndarray. For
            exceptional cases like ``SparseArray``, where returning
            an ndarray would be expensive, an ExtensionArray may be
            returned.
 
        Notes
        -----
        If returning an ExtensionArray, then
 
        * ``na_values._is_boolean`` should be True
        * `na_values` should implement :func:`ExtensionArray._reduce`
        * ``na_values.any`` and ``na_values.all`` should be implemented
        Nrr^rHrHrIr0RszExtensionArray.isnacCst| ¡ ¡ƒS)z€
        Equivalent to `self.isna().any()`.
 
        Some ExtensionArray subclasses may be able to optimize this check.
        )rFr0rir^rHrHrIrhhszExtensionArray._hasnacCs
t |¡S)a    
        Return values for sorting.
 
        Returns
        -------
        ndarray
            The transformed values should maintain the ordering between values
            within the array.
 
        See Also
        --------
        ExtensionArray.argsort : Return the indices that would sort this array.
 
        Notes
        -----
        The caller is responsible for *not* modifying these values in-place, so
        it is safe for implementors to give views on `self`.
 
        Functions that use this (e.g. ExtensionArray.argsort) should ignore
        entries with missing values in the original array (according to `self.isna()`).
        This means that the corresponding entries in the returned array don't need to
        be modified to sort correctly.
        )rprr^rHrHrIÚ_values_for_argsortrsz"ExtensionArray._values_for_argsortZ    quicksortÚlast)Ú    ascendingÚkindÚ na_positionrÚstr)r‚rƒr„rQc    Ks2t |d|¡}| ¡}t||||t | ¡¡dS)a¿
        Return the indices that would sort this array.
 
        Parameters
        ----------
        ascending : bool, default True
            Whether the indices should result in an ascending
            or descending sort.
        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional
            Sorting algorithm.
        *args, **kwargs:
            Passed through to :func:`numpy.argsort`.
 
        Returns
        -------
        np.ndarray[np.intp]
            Array of indices that sort ``self``. If NaN values are contained,
            NaN values are placed at the end.
 
        See Also
        --------
        numpy.argsort : Sorting implementation used internally.
        rH)rƒr‚r„Úmask)ÚnvZvalidate_argsort_with_ascendingr€r;rprqr0)rTr‚rƒr„ÚkwargsrMrHrHrIÚargsorts$ ûzExtensionArray.argsort©ÚskipnarQcCs"t|dƒ|s|jrt‚t|dƒS)aq
        Return the index of minimum value.
 
        In case of multiple occurrences of the minimum value, the index
        corresponding to the first occurrence is returned.
 
        Parameters
        ----------
        skipna : bool, default True
 
        Returns
        -------
        int
 
        See Also
        --------
        ExtensionArray.argmax
        r‹Úargmin©r!rhrXr:©rTr‹rHrHrIrŒ¼s
 
zExtensionArray.argmincCs"t|dƒ|s|jrt‚t|dƒS)aq
        Return the index of maximum value.
 
        In case of multiple occurrences of the maximum value, the index
        corresponding to the first occurrence is returned.
 
        Parameters
        ----------
        skipna : bool, default True
 
        Returns
        -------
        int
 
        See Also
        --------
        ExtensionArray.argmin
        r‹ÚargmaxrrŽrHrHrIrØs
 
zExtensionArray.argmaxzobject | ArrayLike | NonezFillnaOptions | Nonez
int | None)rTr[ÚmethodÚlimitrQcCsŠt||ƒ\}}| ¡}t ||t|ƒ¡}| ¡r~|dk    rlt |¡}| t¡}||||d|j    ||j
d}q†|  ¡}|||<n|  ¡}|S)aŸ
        Fill NA/NaN values using the specified method.
 
        Parameters
        ----------
        value : scalar, array-like
            If a scalar value is passed it is used to fill all missing values.
            Alternatively, an array-like 'value' can be given. It's expected
            that the array-like have the same length as 'self'.
        method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
            Method to use for filling holes in reindexed Series:
 
            * pad / ffill: propagate last valid observation forward to next valid.
            * backfill / bfill: use NEXT valid observation to fill gap.
 
        limit : int, default None
            If method is specified, this is the maximum number of consecutive
            NaN values to forward/backward fill. In other words, if there is
            a gap with more than this number of consecutive NaNs, it will only
            be partially filled. If method is not specified, this is the
            maximum number of entries along the entire axis where NaNs will be
            filled.
 
        Returns
        -------
        ExtensionArray
            With NA/NaN filled.
        N©r‘r†ro) r"r0r2Zcheck_value_sizerariÚ get_fill_funcr|rdrJrDrE)rTr[rr‘r†ÚfuncÚnpvaluesÚ
new_valuesrHrHrIÚfillnaôs""ÿ
 
 
zExtensionArray.fillna)rTrQcCs|| ¡S)zˆ
        Return ExtensionArray without NA values.
 
        Returns
        -------
        pandas.api.extensions.ExtensionArray
        r/r^rHrHrIÚdropna-s    zExtensionArray.dropnarx)ÚperiodsÚ
fill_valuerQcCsŠt|ƒr|dkr| ¡St|ƒr(|jj}|j|gtt|ƒt|ƒƒ|jd}|dkrh|}|d| …}n|t|ƒd…}|}| ||g¡S)a>
        Shift values by desired number.
 
        Newly introduced missing values are filled with
        ``self.dtype.na_value``.
 
        Parameters
        ----------
        periods : int, default 1
            The number of periods to shift. Negative values are allowed
            for shifting backwards.
 
        fill_value : object, optional
            The scalar value to use for newly introduced missing values.
            The default is ``self.dtype.na_value``.
 
        Returns
        -------
        ExtensionArray
            Shifted.
 
        Notes
        -----
        If ``self`` is empty or ``periods`` is 0, a copy of ``self`` is
        returned.
 
        If ``periods > len(self)``, then an array of size
        len(self) is returned, with all values filled with
        ``self.dtype.na_value``.
        rroN)    rarEr0rDrfrJÚminÚabsÚ_concat_same_type)rTr™ršÚemptyÚaÚbrHrHrIÚshift8s!ÿzExtensionArray.shiftcCst| t¡ƒ}|j||jdS)zŒ
        Compute the ExtensionArray of unique values.
 
        Returns
        -------
        pandas.api.extensions.ExtensionArray
        ro)r8r|rdrJrD)rTÚuniquesrHrHrIr8jszExtensionArray.uniqueÚleftz$NumpyValueArrayLike | ExtensionArrayzLiteral[('left', 'right')]r<znpt.NDArray[np.intp] | np.intp)r[ÚsideÚsorterrQcCs.| t¡}t|tƒr| t¡}|j|||dS)a·
        Find indices where elements should be inserted to maintain order.
 
        Find the indices into a sorted array `self` (a) such that, if the
        corresponding elements in `value` were inserted before the indices,
        the order of `self` would be preserved.
 
        Assuming that `self` is sorted:
 
        ======  ================================
        `side`  returned index `i` satisfies
        ======  ================================
        left    ``self[i-1] < value <= self[i]``
        right   ``self[i-1] <= value < self[i]``
        ======  ================================
 
        Parameters
        ----------
        value : array-like, list or scalar
            Value(s) to insert into `self`.
        side : {'left', 'right'}, optional
            If 'left', the index of the first suitable location found is given.
            If 'right', return the last such index.  If there is no suitable
            index, return either 0 or N (where N is the length of `self`).
        sorter : 1-D array-like, optional
            Optional array of integer indices that sort array a into ascending
            order. They are typically the result of argsort.
 
        Returns
        -------
        array of ints or int
            If value is array-like, array of insertion points.
            If value is scalar, a single integer.
 
        See Also
        --------
        numpy.searchsorted : Similar method from NumPy.
        )r¤r¥)r|rdrgr@Ú searchsorted)rTr[r¤r¥ÚarrrHrHrIr¦us1
 
 
zExtensionArray.searchsortedcCs„t|ƒt|ƒkrdStt|ƒ}t|j|jƒs0dSt|ƒt|ƒkrDdS||k}t|tƒr`| d¡}| ¡| ¡@}t    ||B 
¡ƒSdS)aí
        Return if another array is equivalent to this array.
 
        Equivalent means that both arrays have the same shape and dtype, and
        all values compare equal. Missing values in the same location are
        considered equal (in contrast with normal equality).
 
        Parameters
        ----------
        other : ExtensionArray
            Array to compare to this Array.
 
        Returns
        -------
        boolean
            Whether the arrays are equivalent.
        FN) rYr r@r&rDrargr—r0rFÚall)rTrkZ equal_valuesZequal_narHrHrIÚequals«s
 
 
zExtensionArray.equalsznpt.NDArray[np.bool_]cCstt |¡|ƒS)a
        Pointwise comparison for set containment in the given values.
 
        Roughly equivalent to `np.array([x in values for x in self])`
 
        Parameters
        ----------
        values : Sequence
 
        Returns
        -------
        np.ndarray[bool]
        )r5rprq)rTrMrHrHrIr5ÍszExtensionArray.isinztuple[np.ndarray, Any]cCs| t¡tjfS)aý
        Return an array and missing value suitable for factorization.
 
        Returns
        -------
        values : ndarray
 
            An array suitable for factorization. This should maintain order
            and be a supported dtype (Float64, Int64, UInt64, String, Object).
            By default, the extension array is cast to object dtype.
        na_value : object
            The value in `values` to consider missing. This will be treated
            as NA in the factorization routines, so it will be coded as
            `-1` and not included in `uniques`. By default,
            ``np.nan`` is used.
 
        Notes
        -----
        The values returned by this method are also used in
        :func:`pandas.util.hash_pandas_object`.
        )r|rdrpÚnanr^rHrHrIÚ_values_for_factorizeÝsz$ExtensionArray._values_for_factorizez!tuple[np.ndarray, ExtensionArray])Úuse_na_sentinelrQcCs2| ¡\}}t|||d\}}| ||¡}||fS)a
        Encode the extension array as an enumerated type.
 
        Parameters
        ----------
        use_na_sentinel : bool, default True
            If True, the sentinel -1 will be used for NaN values. If False,
            NaN values will be encoded as non-negative integers and will not drop the
            NaN from the uniques of the values.
 
            .. versionadded:: 1.5.0
 
        Returns
        -------
        codes : ndarray
            An integer NumPy array that's an indexer into the original
            ExtensionArray.
        uniques : ExtensionArray
            An ExtensionArray containing the unique values of `self`.
 
            .. note::
 
               uniques will *not* contain an entry for the NA value of
               the ExtensionArray if there are any missing values present
               in `self`.
 
        See Also
        --------
        factorize : Top-level factorize method that dispatches here.
 
        Notes
        -----
        :meth:`pandas.factorize` offers a `sort` keyword as well.
        )r¬rf)r«r4rO)rTr¬r§rfÚcodesr¢Z
uniques_earHrHrIÚ    factorizeõs. ÿ
 zExtensionArray.factorizea;
        Repeat elements of a %(klass)s.
 
        Returns a new %(klass)s where each element of the current %(klass)s
        is repeated consecutively a given number of times.
 
        Parameters
        ----------
        repeats : int or array of ints
            The number of repetitions for each element. This should be a
            non-negative integer. Repeating 0 times will return an empty
            %(klass)s.
        axis : None
            Must be ``None``. Has no effect but is accepted for compatibility
            with numpy.
 
        Returns
        -------
        %(klass)s
            Newly created %(klass)s with repeated elements.
 
        See Also
        --------
        Series.repeat : Equivalent function for Series.
        Index.repeat : Equivalent function for Index.
        numpy.repeat : Similar method for :class:`numpy.ndarray`.
        ExtensionArray.take : Take arbitrary positions.
 
        Examples
        --------
        >>> cat = pd.Categorical(['a', 'b', 'c'])
        >>> cat
        ['a', 'b', 'c']
        Categories (3, object): ['a', 'b', 'c']
        >>> cat.repeat(2)
        ['a', 'a', 'b', 'b', 'c', 'c']
        Categories (3, object): ['a', 'b', 'c']
        >>> cat.repeat([1, 2, 3])
        ['a', 'b', 'b', 'c', 'c', 'c']
        Categories (3, object): ['a', 'b', 'c']
        Úrepeat)Úklasszint | Sequence[int]zAxisInt | None)rTÚrepeatsÚaxisrQcCs.t dd|i¡t t|ƒ¡ |¡}| |¡S)NrHr²)r‡Zvalidate_repeatrpÚarangerar¯Útake)rTr±r²ÚindrHrHrIr¯XszExtensionArray.repeat)Ú
allow_fillršr)rTÚindicesr¶ršrQcCs t|ƒ‚dS)aò
        Take elements from an array.
 
        Parameters
        ----------
        indices : sequence of int or one-dimensional np.ndarray of int
            Indices to be taken.
        allow_fill : bool, default False
            How to handle negative values in `indices`.
 
            * False: negative values in `indices` indicate positional indices
              from the right (the default). This is similar to
              :func:`numpy.take`.
 
            * True: negative values in `indices` indicate
              missing values. These values are set to `fill_value`. Any other
              other negative values raise a ``ValueError``.
 
        fill_value : any, optional
            Fill value to use for NA-indices when `allow_fill` is True.
            This may be ``None``, in which case the default NA value for
            the type, ``self.dtype.na_value``, is used.
 
            For many ExtensionArrays, there will be two representations of
            `fill_value`: a user-facing "boxed" scalar, and a low-level
            physical NA value. `fill_value` should be the user-facing version,
            and the implementation should handle translating that to the
            physical version for processing the take if necessary.
 
        Returns
        -------
        ExtensionArray
 
        Raises
        ------
        IndexError
            When the indices are out of bounds for the array.
        ValueError
            When `indices` contains negative values other than ``-1``
            and `allow_fill` is True.
 
        See Also
        --------
        numpy.take : Take elements from an array along an axis.
        api.extensions.take : Take elements from an array.
 
        Notes
        -----
        ExtensionArray.take is called by ``Series.__getitem__``, ``.loc``,
        ``iloc``, when `indices` is a sequence of values. Additionally,
        it's called by :meth:`Series.reindex`, or any other method
        that causes realignment, with a `fill_value`.
 
        Examples
        --------
        Here's an example implementation, which relies on casting the
        extension array to object dtype. This uses the helper method
        :func:`pandas.api.extensions.take`.
 
        .. code-block:: python
 
           def take(self, indices, allow_fill=False, fill_value=None):
               from pandas.core.algorithms import take
 
               # If the ExtensionArray is backed by an ndarray, then
               # just pass that here instead of coercing to object.
               data = self.astype(object)
 
               if allow_fill and fill_value is None:
                   fill_value = self.dtype.na_value
 
               # fill value should always be translated from the scalar
               # type for the array, to the physical storage type for
               # the data, before passing to take.
 
               result = take(data, indices, fill_value=fill_value,
                             allow_fill=allow_fill)
               return self._from_sequence(result, dtype=self.dtype)
        Nr)rTr·r¶ršrHrHrIr´es]zExtensionArray.takecCs t|ƒ‚dS)ze
        Return a copy of the array.
 
        Returns
        -------
        ExtensionArray
        Nrr^rHrHrIrEÄszExtensionArray.copy)rDrQcCs|dk    rt|ƒ‚|dd…S)a)
        Return a view on the array.
 
        Parameters
        ----------
        dtype : str, np.dtype, or ExtensionDtype, optional
            Default None.
 
        Returns
        -------
        ExtensionArray or np.ndarray
            A view on the :class:`ExtensionArray`'s data.
        N)rX)rTrDrHrHrIÚviewÎszExtensionArray.viewcCsf|jdkr| ¡Sddlm}||| ¡dd d¡}dt|ƒj›d}|›|›d    t|ƒ›d
|j    ›S) Nrxr©Úformat_object_summaryF©Zindent_for_nameú, 
ú<z>
z    
Length: ú    , dtype: )
ryÚ_repr_2dÚpandas.io.formats.printingrºÚ
_formatterÚrstriprYÚ__name__rarD)rTrºÚdataÚ
class_namerHrHrIÚ__repr__ès
 ÿþzExtensionArray.__repr__csZddlm‰‡‡fdd„ˆDƒ}d |¡}dtˆƒj›d}|›d|›d    ˆj›d
ˆj›S) Nrr¹cs$g|]}ˆ|ˆ ¡dd d¡‘qS)Fr»r¼)rÁr©Ú.0Úx©rºrTrHrIÚ
<listcomp>ýsýÿz+ExtensionArray._repr_2d.<locals>.<listcomp>z,
r½ú>z
[
z
 
]
Shape: r¾)rÀrºÚjoinrYrÃrurD)rTÚlinesrÄrÅrHrÊrIr¿÷s  ü
zExtensionArray._repr_2dzCallable[[Any], str | None])ÚboxedrQcCs |rtStS)aY
        Formatting function for scalar values.
 
        This is used in the default '__repr__'. The returned formatting
        function receives instances of your scalar type.
 
        Parameters
        ----------
        boxed : bool, default False
            An indicated for whether or not your array is being printed
            within a Series, DataFrame, or Index (True), or just by
            itself (False). This may be useful if you want scalar values
            to appear differently within a Series versus on its own (e.g.
            quoted or not).
 
        Returns
        -------
        Callable[[Any], str]
            A callable that gets instances of the scalar type and
            returns a string. By default, :func:`repr` is used
            when ``boxed=False`` and :func:`str` is used when
            ``boxed=True``.
        )r…Úrepr)rTrÏrHrHrIrÁszExtensionArray._formatter)ÚaxesrQcGs |dd…S)zµ
        Return a transposed view on this array.
 
        Because ExtensionArrays are always 1D, this is a no-op.  It is included
        for compatibility with np.ndarray.
        NrH)rTrÑrHrHrIÚ    transpose'szExtensionArray.transposecCs| ¡SrR)rÒr^rHrHrIÚT0szExtensionArray.TÚCz$Literal[('C', 'F', 'A', 'K')] | None)ÚorderrQcCs|S)ax
        Return a flattened view on this array.
 
        Parameters
        ----------
        order : {None, 'C', 'F', 'A', 'K'}, default 'C'
 
        Returns
        -------
        ExtensionArray
 
        Notes
        -----
        - Because ExtensionArrays are 1D-only, this is a no-op.
        - The "order" argument is ignored, is for compatibility with NumPy.
        rH)rTrÕrHrHrIÚravel4szExtensionArray.ravelztype[ExtensionArrayT]zSequence[ExtensionArrayT])rGÚ    to_concatrQcCs t|ƒ‚dS)zÄ
        Concatenate multiple array of this dtype.
 
        Parameters
        ----------
        to_concat : sequence of this type
 
        Returns
        -------
        ExtensionArray
        Nr)rGr×rHrHrIrGsz ExtensionArray._concat_same_typecCs|jjSrR)rDrer^rHrHrIrebszExtensionArray._can_hold_na©r‹)Únamer‹rQcKstd|›d|j›ƒ‚dS)a¶
        Return an ExtensionArray performing an accumulation operation.
 
        The underlying data type might change.
 
        Parameters
        ----------
        name : str
            Name of the function, supported values are:
            - cummin
            - cummax
            - cumsum
            - cumprod
        skipna : bool, default True
            If True, skip NA values.
        **kwargs
            Additional keyword arguments passed to the accumulation function.
            Currently, there is no supported kwarg.
 
        Returns
        -------
        array
 
        Raises
        ------
        NotImplementedError : subclass does not define accumulations
        zcannot perform z  with type N)rXrD)rTrÙr‹rˆrHrHrIÚ _accumulatefszExtensionArray._accumulate)rÙr‹cKsJt||dƒ}|dkr8tdt|ƒj›d|j›d|›dƒ‚|fd|i|—ŽS)a
        Return a scalar result of performing the reduction operation.
 
        Parameters
        ----------
        name : str
            Name of the function, supported values are:
            { any, all, min, max, sum, mean, median, prod,
            std, var, sem, kurt, skew }.
        skipna : bool, default True
            If True, skip NaN values.
        **kwargs
            Additional keyword arguments passed to the reduction function.
            Currently, `ddof` is the only supported kwarg.
 
        Returns
        -------
        scalar
 
        Raises
        ------
        TypeError : subclass does not define reductions
        Nú'z ' with dtype z does not support reduction 'r‹)ÚgetattrÚ    TypeErrorrYrÃrD)rTrÙr‹rˆÚmethrHrHrIÚ_reduce†s  ÿzExtensionArray._reducezClassVar[None]Ú__hash__ÚlistcCs |jdkrdd„|DƒSt|ƒS)zÿ
        Return a list of the values.
 
        These are each a scalar type, which is a Python scalar
        (for str, int, float) or a pandas scalar
        (for Timestamp/Timedelta/Interval/Period)
 
        Returns
        -------
        list
        rxcSsg|] }| ¡‘qSrH)ÚtolistrÇrHrHrIr˼sz)ExtensionArray.tolist.<locals>.<listcomp>)ryrár^rHrHrIrâ¯s
zExtensionArray.tolist)rTÚlocrQcCs t t t|ƒ¡|¡}| |¡SrR)rpÚdeleter³rar´)rTrãZindexerrHrHrIrä¿szExtensionArray.deletecCsHt|t|ƒƒ}t|ƒj|g|jd}t|ƒ |d|…|||d…g¡S)aþ
        Insert an item at the given position.
 
        Parameters
        ----------
        loc : int
        item : scalar-like
 
        Returns
        -------
        same type as self
 
        Notes
        -----
        This method should be both type and dtype-preserving.  If the item
        cannot be held in an array of this type/dtype, either ValueError or
        TypeError should be raised.
 
        The default implementation relies on _from_sequence to raise on invalid
        items.
        roN)r#rarYrJrDr)rTrãrPZitem_arrrHrHrIÚinsertÃszExtensionArray.insert)r†rQcCs"t|ƒr||}n|}|||<dS)aé
        Analogue to np.putmask(self, mask, value)
 
        Parameters
        ----------
        mask : np.ndarray[bool]
        value : scalar or listlike
            If listlike, must be arraylike with same length as self.
 
        Returns
        -------
        None
 
        Notes
        -----
        Unlike np.putmask, we do not repeat listlike values with mismatched length.
        'value' should either be a scalar or an arraylike with the same length
        as self.
        N)r')rTr†r[ÚvalrHrHrIÚ_putmaskßs
zExtensionArray._putmask)rTr†rQcCs.| ¡}t|ƒr||}n|}|||<|S)zÞ
        Analogue to np.where(mask, self, value)
 
        Parameters
        ----------
        mask : np.ndarray[bool]
        value : scalar or listlike
 
        Returns
        -------
        same type as self
        )rEr')rTr†r[rsrærHrHrIÚ_whereús  
zExtensionArray._where)rr†rQcCsFt |¡}| t¡}|||| ¡d|j||jd}||||<dS)z™
        Replace values in locations specified by 'mask' using pad or backfill.
 
        See also
        --------
        ExtensionArray.fillna
        r’roN)r2r“r|rdrErJrD)rTrr‘r†r”r•r–rHrHrIÚ_fill_mask_inplaces
 
 
 
z!ExtensionArray._fill_mask_inplacerZaverageZkeep©r²rÚ    na_optionr‚ÚpctrcCs |dkr t‚t||||||dS)z*
        See Series.rank.__doc__.
        rrê)rXr7)rTr²rrër‚rìrHrHrIÚ_rank%s úzExtensionArray._rank)rurDcCsV|jg|d}t t d¡|¡}|j|dd}t||ƒrB||jkrRtd|›dƒ‚|S)zÙ
        Create an ExtensionArray with the given shape and dtype.
 
        See also
        --------
        ExtensionDtype.empty
            ExtensionDtype.empty is the 'official' public version of this API.
        roéÿÿÿÿT)r¶z5Default 'empty' implementation is invalid for dtype='rÛ)rJrpZ broadcast_toZintpr´rgrDrX)rGrurDÚobjZtakerrsrHrHrIÚ_empty=s 
ÿzExtensionArray._emptyznpt.NDArray[np.float64])rTÚqsÚ interpolationrQcCs<t | ¡¡}t |¡}tj}t|||||ƒ}t|ƒ |¡S)zè
        Compute the quantiles of self for each quantile in `qs`.
 
        Parameters
        ----------
        qs : np.ndarray[float64]
        interpolation: str
 
        Returns
        -------
        same type as self
        )rprqr0rªr9rYrJ)rTrñròr†r§ršZ
res_valuesrHrHrIÚ    _quantileTs
 
zExtensionArray._quantile)rTr˜rQcCs t||dS)aT
        Returns the mode(s) of the ExtensionArray.
 
        Always returns `ExtensionArray` even if only one value.
 
        Parameters
        ----------
        dropna : bool, default True
            Don't consider counts of NA values.
 
        Returns
        -------
        same type as self
            Sorted, if possible.
        )r˜)r6)rTr˜rHrHrIÚ_modejszExtensionArray._modeznp.ufunc)ÚufuncrcOs–tdd„|DƒƒrtStj|||f|ž|Ž}|tk    r8|Sd|krVtj|||f|ž|ŽS|dkr€tj|||f|ž|Ž}|tk    r€|Stj|||f|ž|ŽS)Ncss|]}t|tttfƒVqdSrR)rgr.r-r,)rÈrkrHrHrIÚ    <genexpr>sz1ExtensionArray.__array_ufunc__.<locals>.<genexpr>ÚoutÚreduce)riÚNotImplementedr1Z!maybe_dispatch_ufunc_to_dunder_opZdispatch_ufunc_with_outZdispatch_reduction_ufuncZdefault_array_ufunc)rTrõrÚinputsrˆrsrHrHrIÚ__array_ufunc__~sLÿÿÿÿÿÿÿÿÿÿzExtensionArray.__array_ufunc__).).).)T)T)T)NNN)rxN)r£N)T)N)N)F)rÔ)T)HrÃÚ
__module__Ú __qualname__Ú__doc__Z_typÚ classmethodrJrLrOr rUr\r_rcrjrmrnr rrrtÚpropertyrDrurwryrzr|r0rhr€r‰rŒrr—r˜r¡r8r¦r©r5r«r®r>rrr¯r´rEr¸rÆr¿rÁrÒrÓrÖrr rerÚrßÚ__annotations__rârärårçrèrérírðrórôrûrHrHrHrIr@fsâ
ÿ
#-
 
 ü( +    û/ü9 2ü6"þ9þÿ,
ÿû_
     ÿ #ùc@s8eZdZddœdddœdd„Zddœdddœdd„Zd    S)
ÚExtensionArraySupportsAnyAllTrØrFrŠcCs t|ƒ‚dSrRrrŽrHrHrIrišsz ExtensionArraySupportsAnyAll.anycCs t|ƒ‚dSrRrrŽrHrHrIr¨sz ExtensionArraySupportsAnyAll.allN)rÃrürýrir¨rHrHrHrIr™src@sjeZdZdZedd„ƒZeddœdd„ƒZedd    „ƒZeddœd
d „ƒZed d „ƒZ    eddœdd„ƒZ
dS)ÚExtensionOpsMixinzú
    A base class for linking the operators to their dunder names.
 
    .. note::
 
       You may want to set ``__array_priority__`` if you want your
       implementation to be called when involved in binary operations
       with NumPy arrays.
    cCs t|ƒ‚dSrRr©rGÚoprHrHrIÚ_create_arithmetic_method¬sz+ExtensionOpsMixin._create_arithmetic_methodrVrWcCsBt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj    ¡ƒt|d| tj
¡ƒt|d| tj ¡ƒt|d    | tj ¡ƒt|d
| tj ¡ƒt|d | tj¡ƒt|d | tj¡ƒt|d | tj¡ƒt|d| tj¡ƒt|d| t¡ƒt|d| tj¡ƒdS)NÚ__add__Ú__radd__Ú__sub__Ú__rsub__Ú__mul__Ú__rmul__Ú__pow__Ú__rpow__Ú__mod__Ú__rmod__Ú __floordiv__Ú __rfloordiv__Ú __truediv__Ú __rtruediv__Ú
__divmod__Ú __rdivmod__)ÚsetattrrÚoperatorÚaddr3ZraddÚsubZrsubÚmulZrmulÚpowZrpowÚmodZrmodÚfloordivZ    rfloordivÚtruedivZrtruedivÚdivmodÚrdivmod©rGrHrHrIÚ_add_arithmetic_ops°s(
ÿz%ExtensionOpsMixin._add_arithmetic_opscCs t|ƒ‚dSrRrrrHrHrIÚ_create_comparison_methodÅsz+ExtensionOpsMixin._create_comparison_methodcCs|t|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒdS)NrmrnÚ__lt__Ú__gt__Ú__le__Ú__ge__)    rr$rÚeqÚneÚltÚgtÚleÚger"rHrHrIÚ_add_comparison_opsÉs z%ExtensionOpsMixin._add_comparison_opscCs t|ƒ‚dSrRrrrHrHrIÚ_create_logical_methodÒsz(ExtensionOpsMixin._create_logical_methodcCs|t|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj¡ƒt|d| tj    ¡ƒdS)NÚ__and__Ú__rand__Ú__or__Ú__ror__Ú__xor__Ú__rxor__)
rr0rÚand_r3Zrand_Úor_Zror_ÚxorZrxorr"rHrHrIÚ_add_logical_opsÖs z"ExtensionOpsMixin._add_logical_opsN) rÃrürýrþrÿrr#r$r/r0r:rHrHrHrIr¡s
 
 
 
rc@s<eZdZdZed ddœdd„ƒZedd    „ƒZed
d „ƒZdS) ÚExtensionScalarOpsMixinaÐ
    A mixin for defining ops on an ExtensionArray.
 
    It is assumed that the underlying scalar objects have the operators
    already defined.
 
    Notes
    -----
    If you have defined a subclass MyExtensionArray(ExtensionArray), then
    use MyExtensionArray(ExtensionArray, ExtensionScalarOpsMixin) to
    get the arithmetic operators.  After the definition of MyExtensionArray,
    insert the lines
 
    MyExtensionArray._add_arithmetic_ops()
    MyExtensionArray._add_comparison_ops()
 
    to link the operators to your class.
 
    .. note::
 
       You may want to set ``__array_priority__`` if you want your
       implementation to be called when involved in binary operations
       with NumPy arrays.
    TNrF)Úcoerce_to_dtypecs*‡‡‡fdd„}dˆj›d}t|||ƒS)a
        A class method that returns a method that will correspond to an
        operator for an ExtensionArray subclass, by dispatching to the
        relevant operator defined on the individual elements of the
        ExtensionArray.
 
        Parameters
        ----------
        op : function
            An operator that takes arguments op(a, b)
        coerce_to_dtype : bool, default True
            boolean indicating whether to attempt to convert
            the result to the underlying ExtensionArray dtype.
            If it's not possible to create a new ExtensionArray with the
            values, an ndarray is returned instead.
 
        Returns
        -------
        Callable[[Any, Any], Union[ndarray, ExtensionArray]]
            A method that can be bound to a class. When used, the method
            receives the two arguments, one of which is the instance of
            this class, and should return an ExtensionArray or an ndarray.
 
            Returning an ndarray may be necessary when the result of the
            `op` cannot be stored in the ExtensionArray. The dtype of the
            ndarray uses NumPy's normal inference rules.
 
        Examples
        --------
        Given an ExtensionArray subclass called MyExtensionArray, use
 
            __add__ = cls._create_method(operator.add)
 
        in the class definition of MyExtensionArray to create the operator
        for addition, that will be based on the operator implementation
        of the underlying elements of the ExtensionArray
        c    s‚‡fdd„}t|tttfƒr tSˆ}||ƒ}‡fdd„t||ƒDƒ}‡‡‡fdd„}ˆjdkrzt|Ž\}}||ƒ||ƒfS||ƒS)Ncs*t|tƒst|ƒr|}n|gtˆƒ}|SrR)rgr@r'ra)ÚparamZovaluesr^rHrIÚconvert_values#szNExtensionScalarOpsMixin._create_method.<locals>._binop.<locals>.convert_valuescsg|]\}}ˆ||ƒ‘qSrHrH)rÈrŸr )rrHrIrË3szJExtensionScalarOpsMixin._create_method.<locals>._binop.<locals>.<listcomp>cs>ˆr,ttˆƒ|ƒ}t|tˆƒƒs:t |¡}ntj|ˆd}|S)Nro)r$rYrgrprq)r§Úres)r<Ú result_dtyperTrHrIÚ_maybe_convert5s  zNExtensionScalarOpsMixin._create_method.<locals>._binop.<locals>._maybe_convert>r!r )rgr.r-r,rùÚziprÃ)    rTrkr>ZlvaluesZrvaluesr?rArŸr ©r<rr@r^rIÚ_binop"s 
 z6ExtensionScalarOpsMixin._create_method.<locals>._binopÚ__)rÃr)rGrr<r@rDZop_namerHrCrIÚ_create_methodús(&z&ExtensionScalarOpsMixin._create_methodcCs
| |¡SrR)rFrrHrHrIrKsz1ExtensionScalarOpsMixin._create_arithmetic_methodcCs|j|dtdS)NF)r<r@)rFrFrrHrHrIr$Osz1ExtensionScalarOpsMixin._create_comparison_method)TN)rÃrürýrþrÿrFrr$rHrHrHrIr;àsP
r;)XrþÚ
__future__rrÚtypingrrrrrrr    r
r r ÚnumpyrpZ pandas._libsr Zpandas._typingrrrrrrrrrrrrZ pandas.compatrZpandas.compat.numpyrr‡Z pandas.errorsrZpandas.util._decoratorsrrr Zpandas.util._validatorsr!r"r#Zpandas.core.dtypes.castr$Zpandas.core.dtypes.commonr%r&r'r(r)r*Zpandas.core.dtypes.dtypesr+Zpandas.core.dtypes.genericr,r-r.Zpandas.core.dtypes.missingr0Z pandas.corer1r2r3Zpandas.core.algorithmsr4r5r6r7r8Z pandas.core.array_algos.quantiler9Zpandas.core.sortingr:r;r<r=r>rr?r@rrr;rHrHrHrIÚ<module>sP 0  8          ??