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
U
¬ý°dßFã
@sPddlmZddlmZmZmZmZddlZddlm    Z    ddl
Z ddl m Z ddlmZddlmZddlmZddlZddlmmZdd    lmZdd
lmZmZdd lm Z dd l!m"Z"dd l#m$Z$m%Z%m&Z&erîddl'm(Z(ddl)m*Z*Gdd„deƒZ+d!dddœdd„Z,d"dddœdd„Z-d#dddœdd„Z.d$ddddddœdd „Z/dS)%é)Ú annotations)Ú TYPE_CHECKINGÚ
CollectionÚLiteralÚ
NamedTupleN)Úsetp)ÚMatplotlibColor)Úfind_stack_level)Ú is_dict_like©Úremove_na_arraylike©Ú pprint_thing)ÚLinePlotÚMPLPlot)Úcreate_iter_data_given_by)Úget_standard_colors)Úcreate_subplotsÚ flatten_axesÚmaybe_adjust_figure)ÚAxes)ÚLine2DcsòeZdZeddœdd„ƒZdZdZGdd„deƒZd-d
d d œd d„Z    d dœdd„Z
e d.d
dœdd„ƒZ dd„Z d/dd dœdd„Zd dœdd„Zd dœdd„Zd d d!œd"d#„Zd dœd$d%„Zd dœd&d'„Zed(dœd)d*„ƒZe‡fd+d,„ƒZ‡ZS)0ÚBoxPlotzLiteral['box']©ÚreturncCsdS)NZbox©©ÚselfrrúZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/plotting/_matplotlib/boxplot.pyÚ_kind*sz BoxPlot._kindÚ
horizontal)NÚaxesÚdictÚbothc@seZdZUded<ded<dS)z
BoxPlot.BPrÚaxzdict[str, list[Line2D]]ÚlinesN)Ú__name__Ú
__module__Ú __qualname__Ú__annotations__rrrrÚBP2s
r*r!ÚstrÚNone)Ú return_typercKs,||jkrtdƒ‚||_tj||f|ŽdS)Nz2return_type must be {None, 'axes', 'dict', 'both'})Ú_valid_return_typesÚ
ValueErrorr-rÚ__init__)rÚdatar-Úkwargsrrrr07s
zBoxPlot.__init__cCs"|jr|jdkrd|_nd|_dS)NÚverticalF)ÚsubplotsÚ orientationÚsharexÚshareyrrrrÚ _args_adjust?s
zBoxPlot._args_adjustN)r-cKst|jdkr(dd„|Dƒ}dd„|Dƒ}nt|ƒ}|j|f|Ž}|dkrN||fS|dkrh|j||d|fS||fSdS)NécSsg|] }t|ƒ‘qSrr ©Ú.0ÚvrrrÚ
<listcomp>Nsz!BoxPlot._plot.<locals>.<listcomp>cSs(g|] }|jdkr|n t tjg¡‘qS)r)ÚsizeÚnpÚarrayÚnanr:rrrr=Rsr"r#©r$r%)Úndimr Úboxplotr*)Úclsr$ÚyÚ
column_numr-ÚkwdsÚbprrrÚ_plotIs
z BoxPlot._plotcCs¶d|jkrt|jdk    r$tjdtƒd|j d¡|_t|jtƒrzddddg}|jD] }||krPt    d|›d    |›ƒ‚qPnd|_t
d
|jdd }|d |_ |d |_ |d |_ |d |_dS)NÚcolorzC'color' and 'colormap' cannot be used simultaneously. Using 'color')Ú
stacklevelÚboxesÚwhiskersÚmediansÚcapsú!color dict contains invalid key 'ú'. The key must be either é)Ú
num_colorsÚcolormaprKrr9)rHrUÚwarningsÚwarnr    ÚpoprKÚ
isinstancer"r/rÚ_boxes_cÚ _whiskers_cÚ
_medians_cÚ_caps_c)rÚ
valid_keysÚkeyÚcolorsrrrÚ_validate_color_args^s(
 
ý  
ÿ
 
 
zBoxPlot._validate_color_argsrKzQdict[str, MatplotlibColor] | MatplotlibColor | Collection[MatplotlibColor] | None)Ú
color_kwdsrcCsdS©Nr)rrTrbrrrÚ _get_colors}szBoxPlot._get_colorscCsút|jtƒrN|j d|j¡}|j d|j¡}|j d|j¡}|j d|j¡}n0|jpX|j}|jpd|j}|jpp|j}|jp||j}|j d¡sœt    |d|dd|j d¡sºt    |d|dd|j d    ¡sØt    |d|dd|j d
¡söt    |d|dddS) NrMrNrOrPÚboxpropsé©rKÚalphaÚ whiskerpropsÚ medianpropsÚcapprops)
rYrKr"ÚgetrZr[r\r]rHr)rrIrMrNrOrPrrrÚmaybe_color_bp‡s"         zBoxPlot.maybe_color_bpc Cs„|jrètjtd|_|jdk    r,t|j|jƒn|j}t    |j
|dƒD]¢\}\}}|  |¡}|j   ¡}|jdk    rš|j}| t|ƒ¡dd„|jjjdDƒ}n
t|ƒg}|j||f||jdœ|—Ž\}}    | |    ¡||j|<| ||¡qBn˜|jjj}|  d¡}|j   ¡}|j||fd|jdœ|—Ž\}}    | |    ¡||_dd„| 
¡Dƒ}
dd„|
Dƒ}
|jstd    d„tt|
ƒƒDƒ}
| ||
¡dS)
N©Zdtype)r1cSsg|] }t|ƒ‘qSrr )r;Úcolrrrr=·sz&BoxPlot._make_plot.<locals>.<listcomp>r)rGr-cSsg|] \}}|‘qSrr)r;ÚleftÚ_rrrr=ÎscSsg|] }t|ƒ‘qSrr )r;rprrrr=ÏscSsg|] }t|ƒ‘qSrr )r;r_rrrr=Ñs)r4ÚpdÚSeriesÚobjectÚ _return_objÚbyrr1rÚ    enumerateZ
_iter_dataZ_get_axrHÚcopyÚTÚ    set_titlerÚcolumnsÚlevelsrJr-rmÚ_set_ticklabelsÚvaluesZ    use_indexÚrangeÚlen) rr1ÚiÚlabelrFr$rHZ
ticklabelsÚretrIÚlabelsrrrÚ
_make_plot s^ÿý
 
 
 ÿ
ÿÿÿ
 
 
 
 
 
ÿÿÿ
 
zBoxPlot._make_plotr)r$rcCs$|jdkr| |¡n
| |¡dS)Nr3)r5Úset_xticklabelsÚset_yticklabels)rr$r„rrrr}Ôs
 zBoxPlot._set_ticklabelscCsdSrcrrrrrÚ _make_legendÚszBoxPlot._make_legendcCs0|jr| t|jƒ¡|jr,| t|jƒ¡dSrc)ÚxlabelÚ
set_xlabelrÚylabelÚ
set_ylabel)rr$r1rrrÚ_post_plot_logicÝszBoxPlot._post_plot_logicz#Literal[('horizontal', 'vertical')]cCs|j dd¡rdSdSdS)NÚvertTr3r )rHrlrrrrr5äszBoxPlot.orientationcs|jdkrtƒjS|jSdSrc)r-ÚsuperÚresultrur©Ú    __class__rrrës
zBoxPlot.result)r!)Nr!)NrK)r&r'r(ÚpropertyrZ _layout_typer.rr*r0r8Ú classmethodrJrardrmr…r}rˆrr5rÚ __classcell__rrr‘rr)s0
ÿ!ú
4rTFÚbool)Ú numeric_onlyÚgridc
Ksp| |¡} |dkr6t|ttfƒs&|g}| ¡j |¡}t|ƒ} t| |
     dd¡|
     dd¡|||d\} }t
|ƒ}|
     dd¡|
     dd¡}}|
  dd¡rž|pš|}n|p¤|}g}t |ƒD]\\}}||}| |}t |Ž\}}||||f||dœ|
—Ž}| |¡| |¡| |¡q²tj||d    d
}|    dkr.|}t|ƒd krD|d n|}|  d |›¡t| dddddd|S)Nr6Tr7)Únaxesr6r7Úfigsizer$Úlayoutr‰r‹rŽ)r‰r‹F)ÚindexrxrfrzBoxplot grouped by ç333333Ã?çÍÌÌÌÌÌì?皙™™™™¹?皙™™™™É?©ÚbottomÚtoprpÚrightZwspace)ÚgroupbyrYÚlistÚtupleÚ_get_numeric_datar{Ú
differencer€rrXrrlrwÚziprzÚappendr˜rrrsZsuptitler)Zplotfr1r{rvr—r˜ršr$r›r-r2Úgroupedr™Úfigr!Z_axesr‰r‹Z    ax_valuesrroZgp_colÚkeysr~Zre_plotfrZbylinerrrÚ_grouped_plot_by_columnósF
 
 
ú
     
 
 
 
r¯Úint)Úrotr˜c
 
s€ddlm} ˆtjkrtdƒ‚t|tjƒr8| d¡}d}‡fdd„} ddœ‡fdd    „ ‰d
d œ‡‡‡‡fd d „ } | ƒ‰|dkr‚d}nt|t    t
fƒr–|}n|g}|dk    rÈt | |f||||||ˆdœˆ—Ž}n´ˆdkrÔd‰|dk    rätdƒ‚|dkr |dk    rþd|ini}|   |¡|   ¡}W5QRX| ¡}t|jƒ}|dkrDtdƒ‚|dkrV|j}n||}| ||jj|fˆŽ}| |¡|S)Nrz,return_type must be {'axes', 'dict', 'both'}Úxcsªtdd}t |dddg¡}t |d¡}ˆ dd¡}|r¦t|ƒrœddd    d
g}tt|td ƒƒƒ}|     ¡D]2\}}||kr„||||<qft
d |›d |›ƒ‚qfn
|  |¡|S)NrS)rTrr9ÚkrKrMrNrOrPérQrR) rr?Ztaker«rXr
r"rªrÚitemsr/Úfill)rr`r^Z key_to_indexr_Úvalue)rHrrrdGs 
   ÿ
zboxplot.<locals>._get_colorsr,rcs„| d¡s t|dˆddd| d¡s@t|dˆddd| d¡s`t|d    ˆd
dd| d ¡s€t|d ˆd dddS)NrerMrrfrgrirNrjrOr9rkrPrS)rlr)rIrH)r`rrrmds
 
 
 
zboxplot.<locals>.maybe_color_bpr)r$c s8| dd¡| dd¡}}|r,| t|ƒ¡|r>| t|ƒ¡dd„|Dƒ}dd„|Dƒ}|j|f|Ž}ˆdk    r~|jdˆd| dd    ¡}|r–| ¡n| ¡}t    |ƒt    |ƒkrÜt
t    |ƒt    |ƒƒ\}    }
|
d
ksÔt |
ƒ‚||    9}|rð|j |ˆd n|j |ˆd ˆ|f|Žˆd kr|Sˆdkr0tj||d S|SdS)Nr‰r‹cSsg|] }t|ƒ‘qSrr )r;r²rrrr=xsz/boxplot.<locals>.plot_group.<locals>.<listcomp>cSsg|]}tjt|ƒtd‘qS)rn)r?Zasarrayr rtr:rrrr=ysr#)ÚaxisZ    labelsizerŽTr)Zrotationr"rB)rXrŠrrŒrDZ tick_paramsrlZ
get_xticksZ
get_yticksr€ÚdivmodÚAssertionErrorr†r‡rr*) r®r~r$rHr‰r‹rIZ is_verticalZticksrÚ    remainder)Úfontsizermr-r±rrÚ
plot_groupps2  
 
zboxplot.<locals>.plot_group)r{rvr˜ršr$r›r-r!z7The 'layout' keyword is not supported when 'by' is Nonezfigure.figsizez;boxplot method requires numerical columns, nothing to plot.)Úmatplotlib.pyplotÚpyplotrr.r/rYrrrsZto_framer¦r§r¯Z
rc_contextZgcar¨r€r{r~ryr˜)r1Úcolumnrvr$r¼r±r˜ršr›r-rHÚpltrdr½r{rÚrcr™r)r`r¼rHrmr-r±rrD0sd 
 
  #þ÷
ö 
 
 
ÿ
 
rDc
Ks<ddlm} t|f|||||||||    dœ    |
—Ž}|  ¡|S)Nr)    rÀrvr$r¼r˜r±ršr›r-)r¾r¿rDZdraw_if_interactive) rrÀrvr$r¼r±r˜ršr›r-rHrÁrrrÚ boxplot_frameÆs$ ÿö õ rÃ)r4r±r˜r6r7c 
KsF|dkr t|ƒ} t| d||    |
||d\} }t|ƒ}tjtd}t||ƒD]@\\}}}|jf|||||dœ| —Ž}| t    |ƒ¡||j
|<qHt | ddddd    d
n¢t|Ž\}}|j d krÈtj ||d d }n,t|ƒd krì|d  |d d…¡}n|d }|dk    r"t |¡}tj ||g¡}t|jƒ}|jf|||||||dœ| —Ž}|S)NTF)r™Zsqueezer$r6r7ršr›rn)r$rÀr¼r±r˜rržrŸr r¡rrf)r®r¸)rÀr¼r±r˜r$ršr›)r€rrrrrsrtrªrDrzrÚlocrr¸ÚconcatÚjoinÚcomZconvert_to_list_likeZ
MultiIndexZ from_productr¦r~)r¬r4rÀr¼r±r˜r$ršr›r6r7rHr™r­r!rƒr_ÚgroupÚdr®ÚframesZdfZ    multi_keyrrrÚboxplot_frame_groupbyæs`ù
     ÿÿ  
 
 
 
ùø
rË)NNTFNNNN)    NNNNrTNNN)    NNNNrTNNN)
TNNrTNNNFT)0Ú
__future__rÚtypingrrrrrVZmatplotlib.artistrÚnumpyr?Zpandas._typingrZpandas.util._exceptionsr    Zpandas.core.dtypes.commonr
Zpandas.core.dtypes.missingr ZpandasrrZpandas.core.commonÚcoreÚcommonrÇZpandas.io.formats.printingrZ pandas.plotting._matplotlib.corerrZ#pandas.plotting._matplotlib.groupbyrZ!pandas.plotting._matplotlib.stylerZ!pandas.plotting._matplotlib.toolsrrrZmatplotlib.axesrZmatplotlib.linesrrr¯rDrÃrËrrrrÚ<module>sz           Nö?öö"õ