@@ -2532,7 +2532,8 @@ def line(self, **kwds):
2532
2532
Parameters
2533
2533
----------
2534
2534
`**kwds` : optional
2535
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2535
+ Additional keyword arguments are documented in
2536
+ :meth:`pandas.Series.plot`.
2536
2537
2537
2538
Returns
2538
2539
-------
@@ -2556,7 +2557,8 @@ def bar(self, **kwds):
2556
2557
Parameters
2557
2558
----------
2558
2559
`**kwds` : optional
2559
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2560
+ Additional keyword arguments are documented in
2561
+ :meth:`pandas.Series.plot`.
2560
2562
2561
2563
Returns
2562
2564
-------
@@ -2571,7 +2573,8 @@ def barh(self, **kwds):
2571
2573
Parameters
2572
2574
----------
2573
2575
`**kwds` : optional
2574
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2576
+ Additional keyword arguments are documented in
2577
+ :meth:`pandas.Series.plot`.
2575
2578
2576
2579
Returns
2577
2580
-------
@@ -2586,7 +2589,8 @@ def box(self, **kwds):
2586
2589
Parameters
2587
2590
----------
2588
2591
`**kwds` : optional
2589
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2592
+ Additional keyword arguments are documented in
2593
+ :meth:`pandas.Series.plot`.
2590
2594
2591
2595
Returns
2592
2596
-------
@@ -2603,7 +2607,8 @@ def hist(self, bins=10, **kwds):
2603
2607
bins: integer, default 10
2604
2608
Number of histogram bins to be used
2605
2609
`**kwds` : optional
2606
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2610
+ Additional keyword arguments are documented in
2611
+ :meth:`pandas.Series.plot`.
2607
2612
2608
2613
Returns
2609
2614
-------
@@ -2613,26 +2618,74 @@ def hist(self, bins=10, **kwds):
2613
2618
2614
2619
def kde (self , bw_method = None , ind = None , ** kwds ):
2615
2620
"""
2616
- Kernel Density Estimate plot
2621
+ Kernel Density Estimate plot using Gaussian kernels.
2622
+
2623
+ In statistics, kernel density estimation (KDE) is a non-parametric way
2624
+ to estimate the probability density function (PDF) of a random
2625
+ variable. This function uses Gaussian kernels and includes automatic
2626
+ bandwith determination.
2617
2627
2618
2628
Parameters
2619
2629
----------
2620
- bw_method: str, scalar or callable, optional
2621
- The method used to calculate the estimator bandwidth. This can be
2630
+ bw_method : str, scalar or callable, optional
2631
+ The method used to calculate the estimator bandwidth. This can be
2622
2632
'scott', 'silverman', a scalar constant or a callable.
2623
2633
If None (default), 'scott' is used.
2624
2634
See :class:`scipy.stats.gaussian_kde` for more information.
2625
2635
ind : NumPy array or integer, optional
2626
- Evaluation points. If None (default), 1000 equally spaced points
2627
- are used. If `ind` is a NumPy array, the kde is evaluated at the
2628
- points passed. If `ind` is an integer, `ind` number of equally
2629
- spaced points are used.
2630
- `**kwds` : optional
2631
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2636
+ Evaluation points for the estimated PDF. If None (default),
2637
+ 1000 equally spaced points are used. If `ind` is a NumPy array, the
2638
+ kde is evaluated at the points passed. If `ind` is an integer,
2639
+ `ind` number of equally spaced points are used.
2640
+ kwds : optional
2641
+ Additional keyword arguments are documented in
2642
+ :meth:`pandas.Series.plot`.
2632
2643
2633
2644
Returns
2634
2645
-------
2635
2646
axes : matplotlib.AxesSubplot or np.array of them
2647
+
2648
+ See also
2649
+ --------
2650
+ scipy.stats.gaussian_kde : Representation of a kernel-density
2651
+ estimate using Gaussian kernels. This is the function used
2652
+ internally to estimate the PDF.
2653
+
2654
+ Examples
2655
+ --------
2656
+ Given a Series of points randomly sampled from an unknown
2657
+ distribution, estimate this distribution using KDE with automatic
2658
+ bandwidth determination and plot the results, evaluating them at
2659
+ 1000 equally spaced points (default):
2660
+
2661
+ .. plot::
2662
+ :context: close-figs
2663
+
2664
+ >>> s = pd.Series([1, 2, 2.5, 3, 3.5, 4, 5])
2665
+ >>> ax = s.plot.kde()
2666
+
2667
+
2668
+ An scalar fixed bandwidth can be specified. Using a too small bandwidth
2669
+ can lead to overfitting, while a too large bandwidth can result in
2670
+ underfitting:
2671
+
2672
+ .. plot::
2673
+ :context: close-figs
2674
+
2675
+ >>> ax = s.plot.kde(bw_method=0.3)
2676
+
2677
+ .. plot::
2678
+ :context: close-figs
2679
+
2680
+ >>> ax = s.plot.kde(bw_method=3)
2681
+
2682
+ Finally, the `ind` parameter determines the evaluation points for the
2683
+ plot of the estimated PDF:
2684
+
2685
+ .. plot::
2686
+ :context: close-figs
2687
+
2688
+ >>> ax = s.plot.kde(ind=[1, 2, 3, 4, 5])
2636
2689
"""
2637
2690
return self (kind = 'kde' , bw_method = bw_method , ind = ind , ** kwds )
2638
2691
@@ -2645,7 +2698,8 @@ def area(self, **kwds):
2645
2698
Parameters
2646
2699
----------
2647
2700
`**kwds` : optional
2648
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2701
+ Additional keyword arguments are documented in
2702
+ :meth:`pandas.Series.plot`.
2649
2703
2650
2704
Returns
2651
2705
-------
@@ -2660,7 +2714,8 @@ def pie(self, **kwds):
2660
2714
Parameters
2661
2715
----------
2662
2716
`**kwds` : optional
2663
- Keyword arguments to pass on to :py:meth:`pandas.Series.plot`.
2717
+ Additional keyword arguments are documented in
2718
+ :meth:`pandas.Series.plot`.
2664
2719
2665
2720
Returns
2666
2721
-------
@@ -2711,7 +2766,8 @@ def line(self, x=None, y=None, **kwds):
2711
2766
x, y : label or position, optional
2712
2767
Coordinates for each point.
2713
2768
`**kwds` : optional
2714
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2769
+ Additional keyword arguments are documented in
2770
+ :meth:`pandas.DataFrame.plot`.
2715
2771
2716
2772
Returns
2717
2773
-------
@@ -2728,7 +2784,8 @@ def bar(self, x=None, y=None, **kwds):
2728
2784
x, y : label or position, optional
2729
2785
Coordinates for each point.
2730
2786
`**kwds` : optional
2731
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2787
+ Additional keyword arguments are documented in
2788
+ :meth:`pandas.DataFrame.plot`.
2732
2789
2733
2790
Returns
2734
2791
-------
@@ -2745,7 +2802,8 @@ def barh(self, x=None, y=None, **kwds):
2745
2802
x, y : label or position, optional
2746
2803
Coordinates for each point.
2747
2804
`**kwds` : optional
2748
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2805
+ Additional keyword arguments are documented in
2806
+ :meth:`pandas.DataFrame.plot`.
2749
2807
2750
2808
Returns
2751
2809
-------
@@ -2762,7 +2820,8 @@ def box(self, by=None, **kwds):
2762
2820
by : string or sequence
2763
2821
Column in the DataFrame to group by.
2764
2822
`**kwds` : optional
2765
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2823
+ Additional keyword arguments are documented in
2824
+ :meth:`pandas.DataFrame.plot`.
2766
2825
2767
2826
Returns
2768
2827
-------
@@ -2781,7 +2840,8 @@ def hist(self, by=None, bins=10, **kwds):
2781
2840
bins: integer, default 10
2782
2841
Number of histogram bins to be used
2783
2842
`**kwds` : optional
2784
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2843
+ Additional keyword arguments are documented in
2844
+ :meth:`pandas.DataFrame.plot`.
2785
2845
2786
2846
Returns
2787
2847
-------
@@ -2806,7 +2866,8 @@ def kde(self, bw_method=None, ind=None, **kwds):
2806
2866
points passed. If `ind` is an integer, `ind` number of equally
2807
2867
spaced points are used.
2808
2868
`**kwds` : optional
2809
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2869
+ Additional keyword arguments are documented in
2870
+ :meth:`pandas.DataFrame.plot`.
2810
2871
2811
2872
Returns
2812
2873
-------
@@ -2825,7 +2886,8 @@ def area(self, x=None, y=None, **kwds):
2825
2886
x, y : label or position, optional
2826
2887
Coordinates for each point.
2827
2888
`**kwds` : optional
2828
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2889
+ Additional keyword arguments are documented in
2890
+ :meth:`pandas.DataFrame.plot`.
2829
2891
2830
2892
Returns
2831
2893
-------
@@ -2842,7 +2904,8 @@ def pie(self, y=None, **kwds):
2842
2904
y : label or position, optional
2843
2905
Column to plot.
2844
2906
`**kwds` : optional
2845
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2907
+ Additional keyword arguments are documented in
2908
+ :meth:`pandas.DataFrame.plot`.
2846
2909
2847
2910
Returns
2848
2911
-------
@@ -2863,7 +2926,8 @@ def scatter(self, x, y, s=None, c=None, **kwds):
2863
2926
c : label or position, optional
2864
2927
Color of each point.
2865
2928
`**kwds` : optional
2866
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2929
+ Additional keyword arguments are documented in
2930
+ :meth:`pandas.DataFrame.plot`.
2867
2931
2868
2932
Returns
2869
2933
-------
@@ -2888,7 +2952,8 @@ def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None,
2888
2952
gridsize : int, optional
2889
2953
Number of bins.
2890
2954
`**kwds` : optional
2891
- Keyword arguments to pass on to :py:meth:`pandas.DataFrame.plot`.
2955
+ Additional keyword arguments are documented in
2956
+ :meth:`pandas.DataFrame.plot`.
2892
2957
2893
2958
Returns
2894
2959
-------
0 commit comments