na_rm Checks¶Small examples for checking na_rm handling in selected stats.
import numpy as np
import pandas as pd
from lets_plot import *
LetsPlot.setup_html()
df_x = pd.DataFrame({
"x": [1, 2, np.nan, 4, 5, np.nan]
})
df_xy = pd.DataFrame({
"x": [1, 2, np.nan, 4, 5, np.nan],
"y": [2, np.nan, 3, 4, 5, np.nan],
"g": ["A", "A", "A", "B", "B", "B"]
})
stat_summary¶ggplot(df_xy, aes("g", "y")) + stat_summary()
ggplot(df_xy, aes("g", "y")) + stat_summary(na_rm=True)
stat_summary_bin¶ggplot(df_xy, aes("x", "y")) + stat_summary_bin(bins=3)
ggplot(df_xy, aes("x", "y")) + stat_summary_bin(bins=3, na_rm=True)
stat_ecdf¶ggplot(df_x, aes("x")) + stat_ecdf()
ggplot(df_x, aes("x")) + stat_ecdf(na_rm=True)
stat_sum¶ggplot(df_xy, aes("x", "y")) + stat_sum()
ggplot(df_xy, aes("x", "y")) + stat_sum(na_rm=True)