hyb
2025-11-18 7539e6f48c75dcaeb808359cccfd1c0d0d182ce8
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
Ë
nñúh÷ãó®—ddlmZddlmZddlZddlmZddlm    Z    m
Z
ddl m Z erddl mZddlmZdd    lmZmZ    d                     dd
„Z                                dd „Zdd „Zy)é)Ú annotations)Ú TYPE_CHECKINGN)Úremove_na_arraylike)Ú
MultiIndexÚconcat)Úunpack_single_str_list)ÚHashable)Ú
IndexLabel)Ú    DataFrameÚSeriesc    ó—|dk(rd}nd}t|jt«sJ‚|jj|Dcic]2}||jdd…|jj |«|k(f“Œ4c}Scc}w)a~
    Create data for iteration given `by` is assigned or not, and it is only
    used in both hist and boxplot.
 
    If `by` is assigned, return a dictionary of DataFrames in which the key of
    dictionary is the values in groups.
    If `by` is not assigned, return input as is, and this preserves current
    status of iter_data.
 
    Parameters
    ----------
    data : reformatted grouped data from `_compute_plot_data` method.
    kind : str, plot kind. This function is only used for `hist` and `box` plots.
 
    Returns
    -------
    iter_data : DataFrame or Dictionary of DataFrames
 
    Examples
    --------
    If `by` is assigned:
 
    >>> import numpy as np
    >>> tuples = [('h1', 'a'), ('h1', 'b'), ('h2', 'a'), ('h2', 'b')]
    >>> mi = pd.MultiIndex.from_tuples(tuples)
    >>> value = [[1, 3, np.nan, np.nan],
    ...          [3, 4, np.nan, np.nan], [np.nan, np.nan, 5, 6]]
    >>> data = pd.DataFrame(value, columns=mi)
    >>> create_iter_data_given_by(data)
    {'h1':     h1
         a    b
    0  1.0  3.0
    1  3.0  4.0
    2  NaN  NaN, 'h2':     h2
         a    b
    0  NaN  NaN
    1  NaN  NaN
    2  5.0  6.0}
    ÚhistréN)Ú
isinstanceÚcolumnsrÚlevelsÚlocÚget_level_values)ÚdataÚkindÚlevelÚcols    úVH:\Change_password\venv_build\Lib\site-packages\pandas/plotting/_matplotlib/groupby.pyÚcreate_iter_data_given_byrs„€ð^ ˆv‚~؉àˆô d—l‘l¤JÔ /Ð/Ð /ð—<‘<×&Ñ& uÑ-ö à ð     ˆTX‰X’a˜Ÿ™×6Ñ6°uÓ=ÀÑDÐDÑ EÑEò ðùò sÁ7A<cóڗt|«}|j|«}g}|D]:\}}tj|g|g«}||}    ||    _|j |    «Œ<t |d¬«}|S)al
    Internal function to group data, and reassign multiindex column names onto the
    result in order to let grouped data be used in _compute_plot_data method.
 
    Parameters
    ----------
    data : Original DataFrame to plot
    by : grouped `by` parameter selected by users
    cols : columns of data set (excluding columns used in `by`)
 
    Returns
    -------
    Output is the reconstructed DataFrame with MultiIndex columns. The first level
    of MI is unique values of groups, and second level of MI is the columns
    selected by users.
 
    Examples
    --------
    >>> d = {'h': ['h1', 'h1', 'h2'], 'a': [1, 3, 5], 'b': [3, 4, 6]}
    >>> df = pd.DataFrame(d)
    >>> reconstruct_data_with_by(df, by='h', cols=['a', 'b'])
       h1      h2
       a     b     a     b
    0  1.0   3.0   NaN   NaN
    1  3.0   4.0   NaN   NaN
    2  NaN   NaN   5.0   6.0
    r)Úaxis)rÚgroupbyrÚ from_productrÚappendr)
rÚbyÚcolsÚ by_modifiedÚgroupedÚ    data_listÚkeyÚgrouprÚ    sub_groups
          rÚreconstruct_data_with_byr(Xs~€ô<)¨Ó,€K؏l‰l˜;Ó'€Gà€IØò$‰
ˆˆUô×)Ñ)¨C¨5°$¨-Ó8ˆØ˜$‘Kˆ    Ø#ˆ    ÔØ×јÕ#ð $ô ) !Ô $€DØ €Kócó֗|Xt|j«dkDr@tj|jDcgc] }t |«‘Œc}«jSt |«Scc}w)zàInternal function to reformat y given `by` is applied or not for hist plot.
 
    If by is None, input y is 1-d with NaN removed; and if by is not None, groupby
    will take place and input y is multi-dimensional array.
    r)ÚlenÚshapeÚnpÚarrayÚTr)Úyr rs   rÚreformat_hist_y_given_byr1†sS€ð 
€~œ#˜aŸg™g›,¨Ò*܏x‰x¸Q¿S¹SÖA°cÔ,¨SÕ1ÒAÓB×DÑDÐDÜ ˜qÓ !Ð!ùòBs¸A&)r)rr rÚstrÚreturnz"dict[Hashable, DataFrame | Series])rr r r
r!r
r3r )r0ú
np.ndarrayr zIndexLabel | Noner3r4)Ú
__future__rÚtypingrÚnumpyr-Úpandas.core.dtypes.missingrÚpandasrrÚ pandas.plotting._matplotlib.miscrÚcollections.abcr    Úpandas._typingr
r r rr(r1©r)rú<module>r>sxðÝ"å ãå:÷õ
DáÝ(å)÷ð"(ð:Ø
ð:Øð:à'ó:ðz+Ø
ð+Ø#ð+Ø+5ð+àó+ô\"r)