This commit is contained in:
2025-09-07 22:09:54 +02:00
parent e1b817252c
commit 2fc0d000b6
7796 changed files with 2159515 additions and 933 deletions

View File

@ -0,0 +1,20 @@
from pandas.plotting._core import (
PlotAccessor as PlotAccessor,
boxplot as boxplot,
)
from pandas.plotting._misc import (
andrews_curves as andrews_curves,
autocorrelation_plot as autocorrelation_plot,
bootstrap_plot as bootstrap_plot,
deregister,
lag_plot as lag_plot,
parallel_coordinates as parallel_coordinates,
plot_params as plot_params,
radviz as radviz,
register,
scatter_matrix as scatter_matrix,
table as table,
)
deregister_matplotlib_converters = deregister
register_matplotlib_converters = register

View File

@ -0,0 +1,437 @@
from collections.abc import (
Callable,
Hashable,
Iterable,
Sequence,
)
from typing import (
Any,
Literal,
NamedTuple,
overload,
)
from matplotlib.axes import Axes
from matplotlib.colors import Colormap
from matplotlib.lines import Line2D
import numpy as np
import pandas as pd
from pandas import Series
from pandas.core.frame import DataFrame
from scipy.stats import gaussian_kde
from typing_extensions import TypeAlias
from pandas._typing import (
ArrayLike,
HashableT,
HashableT1,
HashableT2,
HashableT3,
npt,
)
class _BoxPlotT(NamedTuple):
ax: Axes
lines: dict[str, list[Line2D]]
_SingleColor: TypeAlias = (
str | list[float] | tuple[float, float, float] | tuple[float, float, float, float]
)
_PlotAccessorColor: TypeAlias = str | list[_SingleColor] | dict[HashableT, _SingleColor]
@overload
def boxplot(
data: DataFrame,
column: Hashable | list[HashableT1] | None = ...,
by: Hashable | list[HashableT2] | None = ...,
ax: Axes | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
return_type: Literal["axes"] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def boxplot(
data: DataFrame,
column: Hashable | list[HashableT1] | None = ...,
by: Hashable | list[HashableT2] | None = ...,
ax: Axes | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
*,
return_type: Literal["dict"],
**kwargs,
) -> dict[str, list[Line2D]]: ...
@overload
def boxplot(
data: DataFrame,
column: Hashable | list[HashableT1] | None = ...,
by: Hashable | list[HashableT2] | None = ...,
ax: Axes | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
*,
return_type: Literal["both"],
**kwargs,
) -> _BoxPlotT: ...
class PlotAccessor:
def __init__(self, data) -> None: ...
@overload
def __call__(
self,
*,
data: Series | DataFrame | None = ...,
x: Hashable = ...,
y: Hashable | Sequence[Hashable] = ...,
kind: Literal[
"line",
"bar",
"barh",
"hist",
"box",
"kde",
"density",
"area",
"pie",
"scatter",
"hexbin",
] = ...,
ax: Axes | None = ...,
subplots: Literal[False] | None = ...,
sharex: bool = ...,
sharey: bool = ...,
layout: tuple[int, int] = ...,
figsize: tuple[float, float] = ...,
use_index: bool = ...,
title: Sequence[str] | None = ...,
grid: bool | None = ...,
legend: bool | Literal["reverse"] = ...,
style: str | list[str] | dict[HashableT1, str] = ...,
logx: bool | Literal["sym"] = ...,
logy: bool | Literal["sym"] = ...,
loglog: bool | Literal["sym"] = ...,
xticks: Sequence[float] = ...,
yticks: Sequence[float] = ...,
xlim: tuple[float, float] | list[float] = ...,
ylim: tuple[float, float] | list[float] = ...,
xlabel: str = ...,
ylabel: str = ...,
rot: float = ...,
fontsize: float = ...,
colormap: str | Colormap | None = ...,
colorbar: bool = ...,
position: float = ...,
table: bool | Series | DataFrame = ...,
yerr: DataFrame | Series | ArrayLike | dict | str = ...,
xerr: DataFrame | Series | ArrayLike | dict | str = ...,
stacked: bool = ...,
secondary_y: bool | list[HashableT2] | tuple[HashableT2, ...] = ...,
mark_right: bool = ...,
include_bool: bool = ...,
backend: str = ...,
**kwargs: Any,
) -> Axes: ...
@overload
def __call__(
self,
*,
data: Series | DataFrame | None = ...,
x: Hashable = ...,
y: Hashable | Sequence[Hashable] = ...,
kind: Literal[
"line",
"bar",
"barh",
"hist",
"kde",
"density",
"area",
"pie",
"scatter",
"hexbin",
] = ...,
ax: Axes | None = ...,
subplots: Literal[True] | Sequence[Iterable[HashableT1]],
sharex: bool = ...,
sharey: bool = ...,
layout: tuple[int, int] = ...,
figsize: tuple[float, float] = ...,
use_index: bool = ...,
title: Sequence[str] | None = ...,
grid: bool | None = ...,
legend: bool | Literal["reverse"] = ...,
style: str | list[str] | dict[HashableT2, str] = ...,
logx: bool | Literal["sym"] = ...,
logy: bool | Literal["sym"] = ...,
loglog: bool | Literal["sym"] = ...,
xticks: Sequence[float] = ...,
yticks: Sequence[float] = ...,
xlim: tuple[float, float] | list[float] = ...,
ylim: tuple[float, float] | list[float] = ...,
xlabel: str = ...,
ylabel: str = ...,
rot: float = ...,
fontsize: float = ...,
colormap: str | Colormap | None = ...,
colorbar: bool = ...,
position: float = ...,
table: bool | Series | DataFrame = ...,
yerr: DataFrame | Series | ArrayLike | dict | str = ...,
xerr: DataFrame | Series | ArrayLike | dict | str = ...,
stacked: bool = ...,
secondary_y: bool | list[HashableT3] | tuple[HashableT3, ...] = ...,
mark_right: bool = ...,
include_bool: bool = ...,
backend: str = ...,
**kwargs: Any,
) -> npt.NDArray[np.object_]: ...
@overload
def __call__(
self,
*,
data: Series | DataFrame | None = ...,
x: Hashable = ...,
y: Hashable | Sequence[Hashable] = ...,
kind: Literal["box"],
ax: Axes | None = ...,
subplots: Literal[True] | Sequence[Iterable[HashableT1]],
sharex: bool = ...,
sharey: bool = ...,
layout: tuple[int, int] = ...,
figsize: tuple[float, float] = ...,
use_index: bool = ...,
title: Sequence[str] | None = ...,
grid: bool | None = ...,
legend: bool | Literal["reverse"] = ...,
style: str | list[str] | dict[HashableT2, str] = ...,
logx: bool | Literal["sym"] = ...,
logy: bool | Literal["sym"] = ...,
loglog: bool | Literal["sym"] = ...,
xticks: Sequence[float] = ...,
yticks: Sequence[float] = ...,
xlim: tuple[float, float] | list[float] = ...,
ylim: tuple[float, float] | list[float] = ...,
xlabel: str = ...,
ylabel: str = ...,
rot: float = ...,
fontsize: float = ...,
colormap: str | Colormap | None = ...,
colorbar: bool = ...,
position: float = ...,
table: bool | Series | DataFrame = ...,
yerr: DataFrame | Series | ArrayLike | dict | str = ...,
xerr: DataFrame | Series | ArrayLike | dict | str = ...,
stacked: bool = ...,
secondary_y: bool | list[HashableT3] | tuple[HashableT3, ...] = ...,
mark_right: bool = ...,
include_bool: bool = ...,
backend: str = ...,
**kwargs: Any,
) -> pd.Series: ...
@overload
def line(
self,
x: Hashable = ...,
y: Hashable = ...,
color: _PlotAccessorColor = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def line(
self,
x: Hashable = ...,
y: Hashable = ...,
color: _PlotAccessorColor = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
@overload
def bar(
self,
x: Hashable = ...,
y: Hashable = ...,
color: _PlotAccessorColor = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def bar(
self,
x: Hashable = ...,
y: Hashable = ...,
color: _PlotAccessorColor = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
@overload
def barh(
self,
x: Hashable = ...,
y: Hashable = ...,
color: _PlotAccessorColor = ...,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def barh(
self,
x: Hashable = ...,
y: Hashable = ...,
color: _PlotAccessorColor = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
@overload
def box(
self,
by: Hashable | list[HashableT] = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def box(
self,
by: Hashable | list[HashableT] = ...,
*,
subplots: Literal[True],
**kwargs,
) -> Series: ...
@overload
def hist(
self,
by: Hashable | list[HashableT] | None = ...,
bins: int = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def hist(
self,
by: Hashable | list[HashableT] | None = ...,
bins: int = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
@overload
def kde(
self,
bw_method: (
Literal["scott", "silverman"]
| float
| Callable[[gaussian_kde], float]
| None
) = ...,
ind: npt.NDArray[np.double] | int | None = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def kde(
self,
bw_method: (
Literal["scott", "silverman"]
| float
| Callable[[gaussian_kde], float]
| None
) = ...,
ind: npt.NDArray[np.double] | int | None = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
@overload
def area(
self,
x: Hashable | None = ...,
y: Hashable | None = ...,
stacked: bool = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def area(
self,
x: Hashable | None = ...,
y: Hashable | None = ...,
stacked: bool = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
@overload
def pie(
self, y: Hashable, *, subplots: Literal[False] | None = ..., **kwargs
) -> Axes: ...
@overload
def pie(
self, y: Hashable, *, subplots: Literal[True], **kwargs
) -> npt.NDArray[np.object_]: ...
@overload
def scatter(
self,
x: Hashable,
y: Hashable,
s: Hashable | Sequence[float] | None = ...,
c: Hashable | list[str] = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def scatter(
self,
x: Hashable,
y: Hashable,
s: Hashable | Sequence[float] | None = ...,
c: Hashable | list[str] = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
@overload
def hexbin(
self,
x: Hashable,
y: Hashable,
C: Hashable | None = ...,
reduce_C_function: Callable[[list], float] | None = ...,
gridsize: int | tuple[int, int] | None = ...,
*,
subplots: Literal[False] | None = ...,
**kwargs,
) -> Axes: ...
@overload
def hexbin(
self,
x: Hashable,
y: Hashable,
C: Hashable | None = ...,
reduce_C_function: Callable[[list], float] | None = ...,
gridsize: int | tuple[int, int] | None = ...,
*,
subplots: Literal[True],
**kwargs,
) -> npt.NDArray[np.object_]: ...
density = kde

View File

@ -0,0 +1,87 @@
from collections.abc import (
Hashable,
Sequence,
)
from typing import (
Any,
Literal,
)
from matplotlib.axes import Axes
from matplotlib.colors import Colormap
from matplotlib.figure import Figure
from matplotlib.table import Table
import numpy as np
from pandas.core.frame import DataFrame
from pandas.core.series import Series
from typing_extensions import TypeAlias
from pandas._typing import (
HashableT,
npt,
)
_Color: TypeAlias = str | Sequence[float]
def table(
ax: Axes,
data: DataFrame | Series,
**kwargs,
) -> Table: ...
def register() -> None: ...
def deregister() -> None: ...
def scatter_matrix(
frame: DataFrame,
alpha: float = 0.5,
figsize: tuple[float, float] | None = None,
ax: Axes | None = None,
grid: bool = False,
diagonal: Literal["hist", "kde"] = "hist",
marker: str = ".",
density_kwds: dict[str, Any] | None = None,
hist_kwds: dict[str, Any] | None = None,
range_padding: float = 0.05,
**kwargs,
) -> npt.NDArray[np.object_]: ...
def radviz(
frame: DataFrame,
class_column: Hashable,
ax: Axes | None = None,
color: _Color | Sequence[_Color] | None = None,
colormap: str | Colormap | None = None,
**kwds,
) -> Axes: ...
def andrews_curves(
frame: DataFrame,
class_column: Hashable,
ax: Axes | None = None,
samples: int = 200,
color: _Color | Sequence[_Color] | None = None,
colormap: str | Colormap | None = None,
**kwargs,
) -> Axes: ...
def bootstrap_plot(
series: Series,
fig: Figure | None = None,
size: int = 50,
samples: int = 500,
**kwds,
) -> Figure: ...
def parallel_coordinates(
frame: DataFrame,
class_column: Hashable,
cols: list[HashableT] | None = None,
ax: Axes | None = None,
color: _Color | Sequence[_Color] | None = None,
use_columns: bool = False,
xticks: Sequence[float] | None = None,
colormap: str | Colormap | None = None,
axvlines: bool = True,
axvlines_kwds: dict[str, Any] | None = None,
sort_labels: bool = False,
**kwargs,
) -> Axes: ...
def lag_plot(series: Series, lag: int = 1, ax: Axes | None = None, **kwds) -> Axes: ...
def autocorrelation_plot(series: Series, ax: Axes | None = None, **kwargs) -> Axes: ...
plot_params: dict[str, Any]