hossam 0.3.5__py3-none-any.whl → 0.3.12__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.
- hossam/__init__.py +67 -60
- hossam/data_loader.py +7 -3
- hossam/{classroom.py → hs_classroom.py} +180 -270
- hossam/{gis.py → hs_gis.py} +35 -26
- hossam/hs_interaction.py +119 -0
- hossam/hs_plot.py +2281 -0
- hossam/hs_prep.py +597 -0
- hossam/hs_stats.py +2704 -0
- hossam/hs_timeserise.py +1104 -0
- hossam/{util.py → hs_util.py} +35 -25
- hossam/leekh.png +0 -0
- {hossam-0.3.5.dist-info → hossam-0.3.12.dist-info}/METADATA +53 -61
- hossam-0.3.12.dist-info/RECORD +17 -0
- hossam/analysis.py +0 -149
- hossam/plot.py +0 -1430
- hossam/prep.py +0 -397
- hossam-0.3.5.dist-info/RECORD +0 -14
- {hossam-0.3.5.dist-info → hossam-0.3.12.dist-info}/WHEEL +0 -0
- {hossam-0.3.5.dist-info → hossam-0.3.12.dist-info}/licenses/LICENSE +0 -0
- {hossam-0.3.5.dist-info → hossam-0.3.12.dist-info}/top_level.txt +0 -0
hossam/__init__.py
CHANGED
|
@@ -1,78 +1,85 @@
|
|
|
1
1
|
from .data_loader import load_data, load_info
|
|
2
|
+
from .hs_stats import oneway_anova
|
|
2
3
|
from matplotlib import pyplot as plt
|
|
3
4
|
from matplotlib import font_manager as fm
|
|
4
5
|
from importlib.resources import files, as_file
|
|
5
|
-
import
|
|
6
|
+
from importlib.metadata import version
|
|
7
|
+
from types import SimpleNamespace
|
|
6
8
|
import warnings
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
try:
|
|
11
|
+
__version__ = version("hossam")
|
|
12
|
+
except Exception:
|
|
13
|
+
__version__ = "develop"
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
|
|
16
|
+
hs_fig = SimpleNamespace(
|
|
17
|
+
dpi=200,
|
|
18
|
+
width=600,
|
|
19
|
+
height=320,
|
|
20
|
+
font_size=6,
|
|
21
|
+
font_weight="light",
|
|
22
|
+
frame_width=0.4,
|
|
23
|
+
line_width=1,
|
|
24
|
+
grid_alpha=0.3,
|
|
25
|
+
grid_width=0.4,
|
|
26
|
+
fill_alpha=0.3
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
__all__ = ["load_data", "load_info", "hs_classroom", "hs_gis", "hs_plot", "hs_prep", "hs_stats", "hs_timeserise", "hs_util", "hs_fig"]
|
|
12
30
|
|
|
13
31
|
|
|
14
32
|
def _init_korean_font():
|
|
15
|
-
|
|
33
|
+
"""
|
|
34
|
+
패키지에 포함된 한글 폰트를 기본 폰트로 설정합니다.
|
|
35
|
+
"""
|
|
36
|
+
font_file = "NotoSansKR-Regular.ttf"
|
|
37
|
+
try:
|
|
38
|
+
# 패키지 리소스에서 폰트 파일 경로 확보
|
|
39
|
+
with as_file(files("hossam") / font_file) as font_path:
|
|
40
|
+
fm.fontManager.addfont(str(font_path))
|
|
41
|
+
fprop = fm.FontProperties(fname=str(font_path))
|
|
42
|
+
fname = fprop.get_name()
|
|
16
43
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
44
|
+
plt.rcParams.update({
|
|
45
|
+
"font.family": fname,
|
|
46
|
+
"font.size": hs_fig.font_size,
|
|
47
|
+
"font.weight": hs_fig.font_weight,
|
|
48
|
+
"axes.unicode_minus": False,
|
|
49
|
+
"text.antialiased": True,
|
|
50
|
+
"lines.antialiased": True,
|
|
51
|
+
"patch.antialiased": True,
|
|
52
|
+
"figure.dpi": hs_fig.dpi,
|
|
53
|
+
"savefig.dpi": hs_fig.dpi * 2,
|
|
54
|
+
"text.hinting": "auto",
|
|
55
|
+
"text.hinting_factor": 8,
|
|
56
|
+
"pdf.fonttype": 42,
|
|
57
|
+
"ps.fonttype": 42,
|
|
58
|
+
})
|
|
59
|
+
print(
|
|
60
|
+
"\n✅ 시각화를 위한 한글 글꼴(NotoSansKR-Regular)이 자동 적용되었습니다."
|
|
61
|
+
)
|
|
62
|
+
return
|
|
63
|
+
except Exception as e:
|
|
64
|
+
warnings.warn(f"\n한글 폰트 초기화: 패키지 폰트 사용 실패 ({e}).")
|
|
25
65
|
|
|
26
|
-
if env_disable:
|
|
27
|
-
return
|
|
28
66
|
|
|
29
|
-
|
|
30
|
-
if env_path:
|
|
31
|
-
try:
|
|
32
|
-
fm.fontManager.addfont(env_path)
|
|
33
|
-
fprop = fm.FontProperties(fname=env_path)
|
|
34
|
-
fname = fprop.get_name()
|
|
35
|
-
plt.rcParams['font.family'] = env_family or fname
|
|
36
|
-
plt.rcParams['font.size'] = int(env_size) if env_size else 6
|
|
37
|
-
plt.rcParams['axes.unicode_minus'] = False
|
|
38
|
-
return
|
|
39
|
-
except Exception as e:
|
|
40
|
-
warnings.warn(f"환경 변수 경로 폰트 사용 실패 ({e}). 패키지/시스템 폰트로 폴백합니다.")
|
|
67
|
+
def _init():
|
|
41
68
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
plt.rcParams['axes.unicode_minus'] = False
|
|
52
|
-
return
|
|
53
|
-
except Exception as e:
|
|
54
|
-
warnings.warn(f"한글 폰트 초기화: 패키지 폰트 사용 실패 ({e}). 시스템 폰트로 폴백합니다.")
|
|
69
|
+
# 안내 메시지 (블릿 리스트)
|
|
70
|
+
messages = [
|
|
71
|
+
"📦 아이티윌 이광호 강사가 제작한 라이브러리를 사용중입니다.",
|
|
72
|
+
"📚 자세한 사용 방법은 https://py.hossam.kr 을 참고하세요.",
|
|
73
|
+
"📧 Email: leekh4232@gmail.com",
|
|
74
|
+
"🎬 Youtube: https://www.youtube.com/@hossam-codingclub",
|
|
75
|
+
"📝 Blog: https://blog.hossam.kr/",
|
|
76
|
+
f"🔖 Version: {__version__}",
|
|
77
|
+
]
|
|
55
78
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
'Malgun Gothic',
|
|
59
|
-
'NanumGothic',
|
|
60
|
-
'AppleGothic',
|
|
61
|
-
'Noto Sans CJK KR',
|
|
62
|
-
'Noto Sans KR',
|
|
63
|
-
'DejaVu Sans'
|
|
64
|
-
]
|
|
65
|
-
for ff in ([env_family] if env_family else []) + fallback_fonts:
|
|
66
|
-
try:
|
|
67
|
-
plt.rcParams['font.family'] = ff
|
|
68
|
-
plt.rcParams['font.size'] = int(env_size) if env_size else 6
|
|
69
|
-
plt.rcParams['axes.unicode_minus'] = False
|
|
70
|
-
return
|
|
71
|
-
except Exception:
|
|
72
|
-
continue
|
|
79
|
+
for msg in messages:
|
|
80
|
+
print(f"{msg}")
|
|
73
81
|
|
|
74
|
-
|
|
82
|
+
_init_korean_font()
|
|
75
83
|
|
|
76
84
|
|
|
77
|
-
|
|
78
|
-
_init_korean_font()
|
|
85
|
+
_init()
|
hossam/data_loader.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# -------------------------------------------------------------
|
|
3
|
+
|
|
1
4
|
import requests
|
|
2
5
|
import json
|
|
3
6
|
from os.path import join, exists
|
|
@@ -8,7 +11,7 @@ from typing import Optional
|
|
|
8
11
|
|
|
9
12
|
BASE_URL = "https://data.hossam.kr"
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
# -------------------------------------------------------------
|
|
12
15
|
def __get_df(path: str, index_col=None) -> DataFrame:
|
|
13
16
|
p = path.rfind(".")
|
|
14
17
|
exec = path[p+1:].lower()
|
|
@@ -54,6 +57,7 @@ def __get_df(path: str, index_col=None) -> DataFrame:
|
|
|
54
57
|
|
|
55
58
|
return df
|
|
56
59
|
|
|
60
|
+
# -------------------------------------------------------------
|
|
57
61
|
def __get_data_url(key: str, local: str = None) -> str:
|
|
58
62
|
global BASE_URL
|
|
59
63
|
|
|
@@ -89,7 +93,7 @@ def __get_data_url(key: str, local: str = None) -> str:
|
|
|
89
93
|
|
|
90
94
|
return path, info.get('desc'), info.get('index')
|
|
91
95
|
|
|
92
|
-
|
|
96
|
+
# -------------------------------------------------------------
|
|
93
97
|
def load_info(search: str = None, local: str = None) -> DataFrame:
|
|
94
98
|
"""메타데이터에서 사용 가능한 데이터셋 정보를 로드한다.
|
|
95
99
|
|
|
@@ -152,7 +156,7 @@ def load_info(search: str = None, local: str = None) -> DataFrame:
|
|
|
152
156
|
|
|
153
157
|
return my_df2
|
|
154
158
|
|
|
155
|
-
|
|
159
|
+
# -------------------------------------------------------------
|
|
156
160
|
def load_data(key: str, local: str = None) -> Optional[DataFrame]:
|
|
157
161
|
"""키로 지정된 데이터셋을 로드한다.
|
|
158
162
|
|