pandas-plots 0.9.7__tar.gz → 0.9.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pandas-plots-0.9.7/src/pandas_plots.egg-info → pandas-plots-0.9.9}/PKG-INFO +1 -1
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/setup.cfg +1 -1
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots/hlp.py +7 -7
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots/tbl.py +7 -1
- {pandas-plots-0.9.7 → pandas-plots-0.9.9/src/pandas_plots.egg-info}/PKG-INFO +1 -1
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/LICENSE +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/README.md +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/pyproject.toml +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots/pls.py +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots/ven.py +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots.egg-info/SOURCES.txt +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots.egg-info/dependency_links.txt +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots.egg-info/requires.txt +0 -0
- {pandas-plots-0.9.7 → pandas-plots-0.9.9}/src/pandas_plots.egg-info/top_level.txt +0 -0
@@ -212,21 +212,21 @@ def create_barcode_from_url(
|
|
212
212
|
plt.show()
|
213
213
|
|
214
214
|
def add_datetime_columns(df: pd.DataFrame, date_column: str = None) -> pd.DataFrame:
|
215
|
+
df_= df.copy()
|
215
216
|
if not date_column:
|
216
|
-
date_column = [col for col in
|
217
|
+
date_column = [col for col in df_.columns if pd.api.types.is_datetime64_any_dtype(df_[col])][0]
|
218
|
+
else:
|
219
|
+
df_[date_column] = pd.to_datetime(df_[date_column])
|
217
220
|
|
218
|
-
if not date_column or not pd.api.types.is_datetime64_any_dtype(
|
221
|
+
if not date_column or not pd.api.types.is_datetime64_any_dtype(df_[date_column]):
|
219
222
|
print("❌ No datetime column found")
|
220
223
|
return
|
221
224
|
|
222
|
-
if [col for col in
|
225
|
+
if [col for col in df_.columns if "YYYY-WW" in col]:
|
223
226
|
print("❌ Added datetime columns already exist")
|
224
227
|
return
|
225
228
|
|
226
229
|
print(f"⏳ Adding datetime columns basing off of: {date_column}")
|
227
|
-
df_= df.copy()
|
228
|
-
|
229
|
-
df_[date_column] = pd.to_datetime(df_[date_column])
|
230
230
|
|
231
231
|
df_["YYYY"] = df_[date_column].dt.year
|
232
232
|
df_["MM"] = df_[date_column].dt.month
|
@@ -235,7 +235,7 @@ def add_datetime_columns(df: pd.DataFrame, date_column: str = None) -> pd.DataFr
|
|
235
235
|
df_["YYYY-MM"] = df_[date_column].dt.to_period("M").astype(str)
|
236
236
|
df_["YYYYQ"] = df_[date_column].dt.to_period("Q").astype(str)
|
237
237
|
df_["YYYY-WW"] = (
|
238
|
-
df_[date_column].dt.isocalendar().year.astype(str) + "-" +
|
238
|
+
df_[date_column].dt.isocalendar().year.astype(str) + "-W" +
|
239
239
|
df_[date_column].dt.isocalendar().week.astype(str).str.zfill(2)
|
240
240
|
)
|
241
241
|
df_["DDD"] = df_[date_column].dt.weekday.map({0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"})
|
@@ -326,6 +326,7 @@ def show_num_df(
|
|
326
326
|
df,
|
327
327
|
total_mode: TOTAL_LITERAL = "sum",
|
328
328
|
total_axis: Literal["x", "y", "xy", None] = "xy",
|
329
|
+
total_exclude: bool = False,
|
329
330
|
heatmap_axis: Literal["x", "y", "xy", None] = None,
|
330
331
|
data_bar_axis: Literal["x", "y", "xy", None] = None,
|
331
332
|
pct_axis: Literal["x", "xy", None] = None,
|
@@ -343,7 +344,7 @@ def show_num_df(
|
|
343
344
|
- df: the DataFrame to display
|
344
345
|
- total_mode: a Literal indicating the mode for aggregating totals ["sum", "mean", "median", "min", "max", "std", "var", "skew", "kurt"]
|
345
346
|
- total_axis (Literal["x", "y", "xy", None], optional): The axis for displaying totals. Defaults to "xy".
|
346
|
-
|
347
|
+
- total_exclude (bool, optional): Whether to exclude totals from the coloring in heatmap and data bar. Defaults to False.
|
347
348
|
- heatmap_axis (Literal["x","y","xy", None], optional): The axis for displaying heatmaps. Defaults to None.
|
348
349
|
- data_bar_axis: a Literal indicating the axis for applying data bar coloring ["x","y","xy", None]
|
349
350
|
- pct_axis: a Literal indicating the directions for displaying percentages ["x","xy", None]. "x" means sum up pct per column
|
@@ -442,6 +443,10 @@ def show_num_df(
|
|
442
443
|
out.bar(
|
443
444
|
color=f"{color_highlight}",
|
444
445
|
axis=0 if data_bar_axis == "x" else 1 if data_bar_axis == "y" else None,
|
446
|
+
width=100,
|
447
|
+
# * apply subset if total_exclude
|
448
|
+
subset=(df_orig.index, df_orig.columns) if total_exclude else None,
|
449
|
+
# align="zero",
|
445
450
|
)
|
446
451
|
|
447
452
|
|
@@ -590,6 +595,7 @@ def show_num_df(
|
|
590
595
|
out.background_gradient(
|
591
596
|
cmap=cmap_heat,
|
592
597
|
axis=None if heatmap_axis == "xy" else 0 if heatmap_axis == "y" else 1,
|
598
|
+
subset=(df_orig.index, df_orig.columns) if total_exclude else None,
|
593
599
|
)
|
594
600
|
|
595
601
|
return out
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|