pandas-plots 0.9.7__tar.gz → 0.9.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pandas-plots
3
- Version: 0.9.7
3
+ Version: 0.9.8
4
4
  Summary: A collection of helper for table handling and vizualization
5
5
  Home-page: https://github.com/smeisegeier/pandas-plots
6
6
  Author: smeisegeier
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = pandas-plots
3
- version = 0.9.7
3
+ version = 0.9.8
4
4
  author = smeisegeier
5
5
  author_email = dexterDSDo@googlemail.com
6
6
  description = A collection of helper for table handling and vizualization
@@ -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 df.columns if pd.api.types.is_datetime64_any_dtype(df[col])][0]
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(df[date_column]):
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 df.columns if "YYYY-WW" in col]:
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"})
@@ -442,6 +442,8 @@ def show_num_df(
442
442
  out.bar(
443
443
  color=f"{color_highlight}",
444
444
  axis=0 if data_bar_axis == "x" else 1 if data_bar_axis == "y" else None,
445
+ width=100,
446
+ # align="zero",
445
447
  )
446
448
 
447
449
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pandas-plots
3
- Version: 0.9.7
3
+ Version: 0.9.8
4
4
  Summary: A collection of helper for table handling and vizualization
5
5
  Home-page: https://github.com/smeisegeier/pandas-plots
6
6
  Author: smeisegeier
File without changes
File without changes