junshan-kit 2.1.4__py2.py3-none-any.whl → 2.1.6__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/DataProcessor.py +45 -0
- junshan_kit/datahub.py +3 -0
- junshan_kit/test.py +5 -0
- {junshan_kit-2.1.4.dist-info → junshan_kit-2.1.6.dist-info}/METADATA +2 -1
- junshan_kit-2.1.6.dist-info/RECORD +7 -0
- junshan_kit-2.1.4.dist-info/RECORD +0 -5
- {junshan_kit-2.1.4.dist-info → junshan_kit-2.1.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
import pandas as pd
|
3
|
+
import os
|
4
|
+
|
5
|
+
import junshan_kit.datahub
|
6
|
+
|
7
|
+
class CSVToPandas:
|
8
|
+
def __init__(self):
|
9
|
+
self.data_downloader = junshan_kit.datahub.kaggle_data()
|
10
|
+
|
11
|
+
|
12
|
+
def read_csv(self, data_name):
|
13
|
+
self.csv_path = f'exp_data/{data_name}/{data_name}.csv'
|
14
|
+
if not os.path.exists(self.csv_path):
|
15
|
+
self.data_downloader.download_data(f'{data_name}', f'exp_data/{data_name}')
|
16
|
+
|
17
|
+
# ----------------- ccfd_kaggle ----------------------------------
|
18
|
+
def ccfd_kaggle(self, data_name = 'ccfd-kaggle', show_info = True):
|
19
|
+
self.read_csv(data_name)
|
20
|
+
|
21
|
+
df = pd.read_csv(self.csv_path)
|
22
|
+
m_before, n_before = df.shape
|
23
|
+
df = df.dropna(axis=0, how='any')
|
24
|
+
m_after, n_after = df.shape
|
25
|
+
df['Class'] = df['Class'].replace(0, -1)
|
26
|
+
|
27
|
+
if show_info:
|
28
|
+
pos_count = (df['Class'] == 1).sum()
|
29
|
+
neg_count = (df['Class'] == -1).sum()
|
30
|
+
|
31
|
+
print('\n' + '='*60)
|
32
|
+
print(f"{'CCFD-Kaggle Dataset Info':^60}")
|
33
|
+
print('='*60)
|
34
|
+
print(f"{'Original size:':<25} {m_before} rows x {n_before} cols")
|
35
|
+
print(f"{'Size after dropping NaNs:':<25} {m_after} rows x {n_after} cols")
|
36
|
+
print(f"{'Export size:':<25} {m_after} rows x {n_after} cols")
|
37
|
+
print(f"{'Positive samples (+1):':<25} {pos_count}")
|
38
|
+
print(f"{'Negative samples (-1):':<25} {neg_count}")
|
39
|
+
print('-'*60)
|
40
|
+
print(f"More details: https://www.jianguoyun.com/p/Dd1clVgQ4ZThCxiwzZQGIAA")
|
41
|
+
print('='*60 + '\n')
|
42
|
+
|
43
|
+
return df
|
44
|
+
|
45
|
+
|
junshan_kit/datahub.py
CHANGED
junshan_kit/test.py
ADDED
@@ -1,11 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: junshan_kit
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.6
|
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
|
7
7
|
Requires-Dist: kagglehub==0.3.13
|
8
8
|
Requires-Dist: numpy==2.2.6
|
9
|
+
Requires-Dist: pandas==2.3.3
|
9
10
|
Requires-Dist: scikit-learn==1.7.1
|
10
11
|
Description-Content-Type: text/markdown
|
11
12
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
junshan_kit/DataProcessor.py,sha256=9mlLYxdDiMX7baZmfJk5QuxT4vx_V728XIFbkXmCP0s,1594
|
2
|
+
junshan_kit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
junshan_kit/datahub.py,sha256=BWcG_TPW1xf_y_GzxRXanuOAB01WugBiO5r53EDbr8s,1815
|
4
|
+
junshan_kit/test.py,sha256=aEaobINtr4Ri0jX6D8u49xgftyA6SE12wx0P6m5x-2w,90
|
5
|
+
junshan_kit-2.1.6.dist-info/METADATA,sha256=KZTS690qvlgOduiYwo6oqshsk4dqY8m9HcVtWu-aXTI,599
|
6
|
+
junshan_kit-2.1.6.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
7
|
+
junshan_kit-2.1.6.dist-info/RECORD,,
|
@@ -1,5 +0,0 @@
|
|
1
|
-
junshan_kit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
junshan_kit/datahub.py,sha256=H5Er9sowGyPhBLEg1UFGYwVLOtGUkonxnVjkWwxixOY,1812
|
3
|
-
junshan_kit-2.1.4.dist-info/METADATA,sha256=Mxa0XwUl-hgpri-PTzhPVu5j0OG2Tt8GY3Y0EGazTzM,570
|
4
|
-
junshan_kit-2.1.4.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
5
|
-
junshan_kit-2.1.4.dist-info/RECORD,,
|
File without changes
|