junshan-kit 2.2.5__py2.py3-none-any.whl → 2.2.7__py2.py3-none-any.whl

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.
junshan_kit/DataSets.py CHANGED
@@ -1,3 +1,64 @@
1
+ """
2
+ ----------------------------------------------------------------------
3
+ >>> Author : Junshan Yin
4
+ >>> Last Updated : 2025-xx-xx
5
+ ----------------------------------------------------------------------
6
+ """
1
7
 
8
+ import os, time
9
+ import pandas as pd
10
+ import junshan_kit.DataProcessor
11
+ import junshan_kit.kit
12
+ from sklearn.preprocessing import StandardScaler
2
13
 
3
14
 
15
+ def download_data(data_name):
16
+ from junshan_kit.kit import JianguoyunDownloaderFirefox, JianguoyunDownloaderChrome
17
+
18
+ # User selects download method
19
+ while True:
20
+ # User inputs download URL
21
+ url = input("Enter the Jianguoyun download URL: ").strip()
22
+
23
+ print("Select download method:")
24
+ print("1. Firefox")
25
+ print("2. Chrome")
26
+ choice = input("Enter the number of your choice (1 or 2): ").strip()
27
+
28
+ if choice == "1":
29
+ JianguoyunDownloaderFirefox(url, f"./exp_data/{data_name}").run()
30
+ print("✅ Download completed using Firefox")
31
+ break
32
+ elif choice == "2":
33
+ JianguoyunDownloaderChrome(url, f"./exp_data/{data_name}").run()
34
+ print("✅ Download completed using Chrome")
35
+ break
36
+ else:
37
+ print("❌ Invalid choice. Please enter 1 or 2.\n")
38
+
39
+
40
+ def credit_card_fraud_detection(data_name = "Credit Card Fraud Detection", print_info = False):
41
+
42
+ csv_path = f'./exp_data/{data_name}/creditcard.csv'
43
+ drop_cols = []
44
+ label_col = 'Class'
45
+ label_map = {0: -1, 1: 1}
46
+
47
+ if not os.path.exists(csv_path):
48
+ print('\n' + '*'*60)
49
+ print(f"Please download the data.")
50
+ print(csv_path)
51
+ download_data(data_name)
52
+ junshan_kit.kit.unzip_file(f'./exp_data/{data_name}/{data_name}.zip', f'./exp_data/{data_name}')
53
+
54
+ cleaner = junshan_kit.DataProcessor.CSV_TO_Pandas()
55
+ df = cleaner.preprocess_dataset(csv_path, drop_cols, label_col, label_map, print_info=print_info)
56
+
57
+ return df
58
+
59
+
60
+
61
+
62
+ def wine_and_food_pairing_dataset():
63
+ pass
64
+
junshan_kit/kit.py CHANGED
@@ -45,11 +45,11 @@ def unzip_file(zip_path: str, unzip_folder: str):
45
45
  from selenium.webdriver.chrome.options import Options as ChromeOptions
46
46
  class JianguoyunDownloaderChrome:
47
47
  """ Example:
48
- >>> url = "https://www.jianguoyun.com/p/DdyHJxUQqdHDDRjvtI0GIAA"
48
+ >>> url = "https://www.jianguoyun.com/p/DSQqUq8QqdHDDRiy6I0GIAA"
49
49
  >>> downloader = JianguoyunDownloaderChrome(url)
50
50
  >>> downloader.run()
51
51
  """
52
- def __init__(self, url, download_path="./downloads"):
52
+ def __init__(self, url, download_path="./exp_data"):
53
53
  self.url = url
54
54
  self.download_path = os.path.abspath(download_path)
55
55
  os.makedirs(self.download_path, exist_ok=True)
@@ -147,11 +147,11 @@ from selenium.webdriver.firefox.service import Service
147
147
 
148
148
  class JianguoyunDownloaderFirefox:
149
149
  """ Example:
150
- >>> url = "https://www.jianguoyun.com/p/DdyHJxUQqdHDDRjvtI0GIAA"
150
+ >>> url = "https://www.jianguoyun.com/p/DSQqUq8QqdHDDRiy6I0GIAA"
151
151
  >>> downloader = JianguoyunDownloaderFirefox(url)
152
152
  >>> downloader.run()
153
153
  """
154
- def __init__(self, url, download_path="./downloads"):
154
+ def __init__(self, url, download_path="./exp_data"):
155
155
  self.url = url
156
156
  self.download_path = os.path.abspath(download_path)
157
157
  os.makedirs(self.download_path, exist_ok=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: junshan_kit
3
- Version: 2.2.5
3
+ Version: 2.2.7
4
4
  Summary: This is an optimization tool.
5
5
  Author-email: Junshan Yin <junshanyin@163.com>
6
6
  Requires-Dist: kaggle==1.7.4.5
@@ -0,0 +1,7 @@
1
+ junshan_kit/DataProcessor.py,sha256=eryVmS5BFZj8wjDN2QWVHqkbFgFuWU0HXV9s6TGf9QM,4442
2
+ junshan_kit/DataSets.py,sha256=QOpHAJkDLWBXP31cG8BStrXZITJEBiTCB1brmAy4TBQ,1985
3
+ junshan_kit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ junshan_kit/kit.py,sha256=tB1TpW9hW1EweK1RQwHOdUo7uG1QU4vSeyR0fdaSydo,9569
5
+ junshan_kit-2.2.7.dist-info/METADATA,sha256=LNjAHPrUu_tJs4HrYk2fyC-3GSb3UQj1c_4WIVYv7Wo,329
6
+ junshan_kit-2.2.7.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
7
+ junshan_kit-2.2.7.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- junshan_kit/DataProcessor.py,sha256=eryVmS5BFZj8wjDN2QWVHqkbFgFuWU0HXV9s6TGf9QM,4442
2
- junshan_kit/DataSets.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
3
- junshan_kit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- junshan_kit/kit.py,sha256=FaQT0H7FLKUuTNgU0zfU7Qn3MsjeW6C_rsrB_UOEVJ4,9571
5
- junshan_kit-2.2.5.dist-info/METADATA,sha256=6eUE_T57eUMtYiE958tpJp7glbX2qXyMObOhW_n0INo,329
6
- junshan_kit-2.2.5.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
7
- junshan_kit-2.2.5.dist-info/RECORD,,