utilskit 0.2.11__tar.gz → 0.2.13__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.
Files changed (28) hide show
  1. {utilskit-0.2.11/utilskit.egg-info → utilskit-0.2.13}/PKG-INFO +5 -1
  2. {utilskit-0.2.11 → utilskit-0.2.13}/README.md +4 -0
  3. {utilskit-0.2.11 → utilskit-0.2.13}/pyproject.toml +1 -1
  4. {utilskit-0.2.11 → utilskit-0.2.13}/test/test.py +15 -9
  5. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/dataframeutils/dataframeutils.py +17 -0
  6. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/repeatutils/repeatutils.py +220 -183
  7. {utilskit-0.2.11 → utilskit-0.2.13/utilskit.egg-info}/PKG-INFO +5 -1
  8. {utilskit-0.2.11 → utilskit-0.2.13}/MANIFEST.in +0 -0
  9. {utilskit-0.2.11 → utilskit-0.2.13}/setup.cfg +0 -0
  10. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/__init__.py +0 -0
  11. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/classificationutils/__init__.py +0 -0
  12. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/classificationutils/classificationutils.py +0 -0
  13. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/dataframeutils/__init__.py +0 -0
  14. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/dbutils/__init__.py +0 -0
  15. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/dbutils/dbutils.py +0 -0
  16. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/logutils/__init__.py +0 -0
  17. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/logutils/logutils.py +0 -0
  18. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/plotutils/__init__.py +0 -0
  19. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/plotutils/plotutils.py +0 -0
  20. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/repeatutils/__init__.py +0 -0
  21. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/timeutils/__init__.py +0 -0
  22. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/timeutils/timeutils.py +0 -0
  23. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/utils/__init__.py +0 -0
  24. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit/utils/utils.py +0 -0
  25. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit.egg-info/SOURCES.txt +0 -0
  26. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit.egg-info/dependency_links.txt +0 -0
  27. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit.egg-info/requires.txt +0 -0
  28. {utilskit-0.2.11 → utilskit-0.2.13}/utilskit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: utilskit
3
- Version: 0.2.11
3
+ Version: 0.2.13
4
4
  Summary: 다양한 편의성 함수 모음 패키지
5
5
  Author-email: kimyh <kim_yh663927@naver.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -17,6 +17,10 @@ Requires-Dist: tqdm==4.67.1
17
17
  Requires-Dist: xlrd==2.0.2
18
18
  Requires-Dist: openpyxl==3.1.5
19
19
 
20
+ # 0.2.13
21
+ - repeatutils 에 section_union 함수 추가
22
+ # 0.2.12
23
+ - dataframeutils 의 fill_repeat_nan 함수가 NaN 이 딱 하나만 있는 경우 보정하지 못하는 현상 수정
20
24
  # 0.2.11
21
25
  - dataframeutils 의 fill_repeat_nan 함수가 3 이하 반복되는 NaN 이 아닌 3 이상 반복되는 NaN 구간에 대해 보정하는 현상 수정
22
26
  # 0.2.10
@@ -1,3 +1,7 @@
1
+ # 0.2.13
2
+ - repeatutils 에 section_union 함수 추가
3
+ # 0.2.12
4
+ - dataframeutils 의 fill_repeat_nan 함수가 NaN 이 딱 하나만 있는 경우 보정하지 못하는 현상 수정
1
5
  # 0.2.11
2
6
  - dataframeutils 의 fill_repeat_nan 함수가 3 이하 반복되는 NaN 이 아닌 3 이상 반복되는 NaN 구간에 대해 보정하는 현상 수정
3
7
  # 0.2.10
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
8
8
  name = "utilskit"
9
9
 
10
10
  # 버전
11
- version = "0.2.11"
11
+ version = "0.2.13"
12
12
 
13
13
  # 패키지 설명 (짧은 설명)
14
14
  description = "다양한 편의성 함수 모음 패키지"
@@ -401,20 +401,26 @@ def main16():
401
401
 
402
402
  def main17():
403
403
  from utilskit import repeatutils as rpu
404
+ from utilskit import dataframeutils as dfu
404
405
  import numpy as np
406
+ import pandas as pd
405
407
 
406
408
  # data = [1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7]
407
- ary = np.array([-1, 0, 1, 2, 3, 4, 111, 1223])
409
+ ary = np.array([-1, 0, np.nan, 2, 3, 4, np.nan, np.nan, 7, 8, np.nan])
410
+ df = pd.DataFrame({'value':ary})
411
+
412
+ df = dfu.fill_repeat_nan(df, 'value', repeat=5)
413
+ print(df)
414
+ sys.exit()
415
+
408
416
  # data = ['아', '메', '리', '카']
409
417
  section = rpu.get_section(
410
- data=ary,
411
- repeat=2,
412
- max_key=99,
413
- min_key=1,
414
- max_equal=False,
415
- min_equal=False,
416
- between=True
417
- )
418
+ data=ary,
419
+ key='nan',
420
+ except_nan=False,
421
+ repeat=3,
422
+ mode='b'
423
+ )
418
424
  # section = rpu.get_section(data=data_tf, repeat=w_re, key=75)
419
425
  print(section)
420
426
 
@@ -138,6 +138,22 @@ def fill_repeat_nan(dataframe, column, repeat=5):
138
138
  repeat=repeat,
139
139
  mode='b'
140
140
  )
141
+
142
+ # NaN 가 하나만 있는 경우
143
+ for i, d in enumerate(stan_ary):
144
+ if str(d) == 'nan':
145
+ pre_val = str(stan_ary[i-1])
146
+ if (i-1) == -1:
147
+ pre_val = '1'
148
+
149
+ try:
150
+ next_val = str(stan_ary[i+1])
151
+ except IndexError:
152
+ next_val = '1'
153
+
154
+ if (pre_val != 'nan') and (next_val != 'nan'):
155
+ section['nan'].append((i, i))
156
+
141
157
  # 결측치 채우기
142
158
  if len(section) > 0:
143
159
  section = section['nan']
@@ -147,6 +163,7 @@ def fill_repeat_nan(dataframe, column, repeat=5):
147
163
  for (nan_si, nan_ei) in section:#zip(nan_start_idx_list, nan_end_idx_list):
148
164
  df.loc[nan_si-1:nan_ei, column] = df.loc[nan_si-1:nan_ei, column].fillna(method='ffill')
149
165
  df.loc[nan_si:nan_ei+1, column] = df.loc[nan_si:nan_ei+1, column].fillna(method='bfill')
166
+
150
167
  return df
151
168
 
152
169
 
@@ -4,33 +4,33 @@ import numpy as np
4
4
  import pandas as pd
5
5
  import warnings
6
6
 
7
- __all__ = ['get_section']
8
-
9
-
10
- def issame(value1, value2):
11
- # 서로 같은 경우
12
- if value1 == value2:
13
- return True
14
- # 서로 다른 경우
15
- else:
16
- # 어느 한 쪽 이라도 str type 인 경우
17
- if isinstance(value1, str) or isinstance(value2, str):
18
- if str(value1) == str(value2):
19
- return True # ex) value1 = 1, value2 = '1'
20
- else:
21
- return False # ex) value1 = 1, value2 = 'nan'
22
- # 어느 한 쪽이라도 str type 이 아닌 경우
23
- else:
24
- # value1 이 NaN 일때
25
- if np.isnan(value1):
26
- # value2 도 NaN 이면
27
- if np.isnan(value2):
28
- return True
29
- # value2 가 NaN 이 아니면
30
- else:
31
- return False
32
- else:
33
- return False
7
+ __all__ = ['get_section', 'section_union']
8
+
9
+
10
+ # def issame(value1, value2):
11
+ # # 서로 같은 경우
12
+ # if value1 == value2:
13
+ # return True
14
+ # # 서로 다른 경우
15
+ # else:
16
+ # # 어느 한 쪽 이라도 str type 인 경우
17
+ # if isinstance(value1, str) or isinstance(value2, str):
18
+ # if str(value1) == str(value2):
19
+ # return True # ex) value1 = 1, value2 = '1'
20
+ # else:
21
+ # return False # ex) value1 = 1, value2 = 'nan'
22
+ # # 어느 한 쪽이라도 str type 이 아닌 경우
23
+ # else:
24
+ # # value1 이 NaN 일때
25
+ # if np.isnan(value1):
26
+ # # value2 도 NaN 이면
27
+ # if np.isnan(value2):
28
+ # return True
29
+ # # value2 가 NaN 이 아니면
30
+ # else:
31
+ # return False
32
+ # else:
33
+ # return False
34
34
 
35
35
 
36
36
  # def get_repeat_section2(data, repeat_num, refer_value=None, except_nan=True):
@@ -95,177 +95,177 @@ def issame(value1, value2):
95
95
 
96
96
 
97
97
 
98
- def get_repeat_section(data, repeat, except_nan=True):
99
- '''
100
- 데이터 array 에서 정해놓은 반복 횟수 (stan_repeat) 만큼 반복되는 숫자구간이 있다면
101
- 그 구간의 시작, 끝 위치 index 값을 추출한다.
102
- NaN 가 반복되는지 여부를 포함시킬 수 있다.
103
- '''
104
- ary = data.copy()
98
+ # def get_repeat_section(data, repeat, except_nan=True):
99
+ # '''
100
+ # 데이터 array 에서 정해놓은 반복 횟수 (stan_repeat) 만큼 반복되는 숫자구간이 있다면
101
+ # 그 구간의 시작, 끝 위치 index 값을 추출한다.
102
+ # NaN 가 반복되는지 여부를 포함시킬 수 있다.
103
+ # '''
104
+ # ary = data.copy()
105
105
 
106
- value_list = []
107
- start_idx_list = []
108
- end_idx_list = []
109
- start_idx = 0
110
- # pre_value = 'nan'
111
- repeat_num = 1
112
- for idx, value in enumerate(ary):
106
+ # value_list = []
107
+ # start_idx_list = []
108
+ # end_idx_list = []
109
+ # start_idx = 0
110
+ # # pre_value = 'nan'
111
+ # repeat_num = 1
112
+ # for idx, value in enumerate(ary):
113
113
 
114
- # 가장 처음인 경우
115
- if idx == 0:
116
- pre_value = value
117
- continue
114
+ # # 가장 처음인 경우
115
+ # if idx == 0:
116
+ # pre_value = value
117
+ # continue
118
118
 
119
- # 현재 값이 이전 값과 동일할때
120
- if issame(value, pre_value):
121
- repeat_num += 1
119
+ # # 현재 값이 이전 값과 동일할때
120
+ # if issame(value, pre_value):
121
+ # repeat_num += 1
122
122
 
123
- # 현재 값이 이전 값과 다를때
124
- else:
125
- if repeat_num >= repeat:
126
- value_list.append(pre_value)
127
- start_idx_list.append(start_idx)
128
- end_idx_list.append(idx-1)
129
- # 시작 지점 갱신 & 반복횟수 초기화
130
- start_idx = idx
131
- repeat_num = 1
132
-
133
- pre_value = value
134
-
135
- # 마지막 값이 이전 값과 같을때
136
- if issame(value, pre_value):
137
- if repeat_num >= repeat:
138
- value_list.append(value)
139
- start_idx_list.append(start_idx)
140
- end_idx_list.append(idx)
141
- # --------------------------------------
142
- # 함수 수정중
143
- # 결과 정리
144
- # print(value_list)
145
- # sys.exit()
146
- result = {}
147
- for v, si, ei in zip(value_list, start_idx_list, end_idx_list):
148
- try:
149
- result[str(v)].append((si, ei))
150
- except KeyError:
151
- result[str(v)] = [(si, ei)]
152
- if except_nan:
153
- del result['nan']
154
- return result
123
+ # # 현재 값이 이전 값과 다를때
124
+ # else:
125
+ # if repeat_num >= repeat:
126
+ # value_list.append(pre_value)
127
+ # start_idx_list.append(start_idx)
128
+ # end_idx_list.append(idx-1)
129
+ # # 시작 지점 갱신 & 반복횟수 초기화
130
+ # start_idx = idx
131
+ # repeat_num = 1
155
132
 
133
+ # pre_value = value
156
134
 
157
- def get_stan_repeat_section(data, value, repeat, mode='a', reverse=False):
158
- '''
159
- ary 에서 기준값(stan_value)이 지정한 횟수(stan_repeat)
160
- 이상(above) 또는 이하(below) 만큼 반복되는 구간의 시작, 끝 위치 index 값을 추출하는 함수
161
- reverse 를 True 로 지정하면 해당 각 구간의 끝->시작, 시작->끝 으로 반전된다.
162
- mode 는 a (above) 와 b (below)만 존재
163
- '''
164
- ary = data.copy()
135
+ # # 마지막 값이 이전 값과 같을때
136
+ # if issame(value, pre_value):
137
+ # if repeat_num >= repeat:
138
+ # value_list.append(value)
139
+ # start_idx_list.append(start_idx)
140
+ # end_idx_list.append(idx)
141
+ # # --------------------------------------
142
+ # # 함수 수정중
143
+ # # 결과 정리
144
+ # # print(value_list)
145
+ # # sys.exit()
146
+ # result = {}
147
+ # for v, si, ei in zip(value_list, start_idx_list, end_idx_list):
148
+ # try:
149
+ # result[str(v)].append((si, ei))
150
+ # except KeyError:
151
+ # result[str(v)] = [(si, ei)]
152
+ # if except_nan:
153
+ # del result['nan']
154
+ # return result
155
+
156
+
157
+ # def get_stan_repeat_section(data, value, repeat, mode='a', reverse=False):
158
+ # '''
159
+ # ary 에서 기준값(stan_value)이 지정한 횟수(stan_repeat)
160
+ # 이상(above) 또는 이하(below) 만큼 반복되는 구간의 시작, 끝 위치 index 값을 추출하는 함수
161
+ # reverse 를 True 로 지정하면 해당 각 구간의 끝->시작, 시작->끝 으로 반전된다.
162
+ # mode 는 a (above) 와 b (below)만 존재
163
+ # '''
164
+ # ary = data.copy()
165
165
 
166
- start_idx = 0
167
- start_idx_list = []
168
- end_idx_list = []
169
- repeat_num = 1
166
+ # start_idx = 0
167
+ # start_idx_list = []
168
+ # end_idx_list = []
169
+ # repeat_num = 1
170
170
 
171
- if len(ary) == 0:
172
- return [], []
171
+ # if len(ary) == 0:
172
+ # return [], []
173
173
 
174
- # stan_value = float(stan_value)
175
- for idx, val_ in enumerate(ary):
174
+ # # stan_value = float(stan_value)
175
+ # for idx, val_ in enumerate(ary):
176
176
 
177
- # 가장 처음인 경우
178
- if idx == 0:
179
- pre_value = val_
180
- continue
177
+ # # 가장 처음인 경우
178
+ # if idx == 0:
179
+ # pre_value = val_
180
+ # continue
181
181
 
182
- # 현재 값이 기준값(stan_value) 인 경우
183
- if issame(val_, value):
184
- # 이전값이 기준값과 동일하면
185
- if issame(pre_value, value):
186
- # 반복횟수 +1
187
- repeat_num += 1
188
- # 이전 값이 기준값과 다르면
189
- else:
190
- # 반복횟수 초기화
191
- repeat_num = 1
192
- # 현재 위치를 시작로 위치 지정
193
- start_idx = idx
194
- # 현재 값이 기준값과 다른 경우
195
- else:
196
- # 이전 값이 기준값과 동일하면
197
- if issame(pre_value, value):
198
- # idx 끝 위치 지정
199
-
200
- # 반복 횟수 기준 이상인 경우
201
- if mode == 'a':
202
- # 기록된 반복 횟수가 기준 횟수 이상이면
203
- if repeat_num >= repeat:
204
- # 지정해둔 시작 위치 index 값을 구간시작 index 로 저장
205
- start_idx_list.append(start_idx)
206
- # 현재 위치 바로 이전 위치 index 값을 구간끝 index 로 저장
207
- end_idx_list.append(idx-1)
208
- # 반복 횟수 기준 이하인 경우
209
- elif mode == 'b':
210
- # 기록된 반복 횟수가 기준 횟수 이하면
211
- if repeat_num <= repeat:
212
- start_idx_list.append(start_idx)
213
- end_idx_list.append(idx-1)
214
- elif mode == 'e':
215
- # 기록된 반복 횟수가 기준 횟수와 동일하면
216
- if repeat_num == repeat:
217
- start_idx_list.append(start_idx)
218
- end_idx_list.append(idx-1)
219
- else:
220
- print('mode 를 a (above:이상), b (below:이하) 또는 e (equal:동일) 중 하나로 지정해주세요')
221
- raise KeyError()
222
- # 현재 위치 값을 이전 위치로 저장
223
- pre_value = val_
182
+ # # 현재 값이 기준값(stan_value) 인 경우
183
+ # if issame(val_, value):
184
+ # # 이전값이 기준값과 동일하면
185
+ # if issame(pre_value, value):
186
+ # # 반복횟수 +1
187
+ # repeat_num += 1
188
+ # # 이전 값이 기준값과 다르면
189
+ # else:
190
+ # # 반복횟수 초기화
191
+ # repeat_num = 1
192
+ # # 현재 위치를 시작로 위치 지정
193
+ # start_idx = idx
194
+ # # 현재 값이 기준값과 다른 경우
195
+ # else:
196
+ # # 이전 값이 기준값과 동일하면
197
+ # if issame(pre_value, value):
198
+ # # idx 끝 위치 지정
199
+
200
+ # # 반복 횟수 기준 이상인 경우
201
+ # if mode == 'a':
202
+ # # 기록된 반복 횟수가 기준 횟수 이상이면
203
+ # if repeat_num >= repeat:
204
+ # # 지정해둔 시작 위치 index 값을 구간시작 index 로 저장
205
+ # start_idx_list.append(start_idx)
206
+ # # 현재 위치 바로 이전 위치 index 값을 구간끝 index 로 저장
207
+ # end_idx_list.append(idx-1)
208
+ # # 반복 횟수 기준 이하인 경우
209
+ # elif mode == 'b':
210
+ # # 기록된 반복 횟수가 기준 횟수 이하면
211
+ # if repeat_num <= repeat:
212
+ # start_idx_list.append(start_idx)
213
+ # end_idx_list.append(idx-1)
214
+ # elif mode == 'e':
215
+ # # 기록된 반복 횟수가 기준 횟수와 동일하면
216
+ # if repeat_num == repeat:
217
+ # start_idx_list.append(start_idx)
218
+ # end_idx_list.append(idx-1)
219
+ # else:
220
+ # print('mode 를 a (above:이상), b (below:이하) 또는 e (equal:동일) 중 하나로 지정해주세요')
221
+ # raise KeyError()
222
+ # # 현재 위치 값을 이전 위치로 저장
223
+ # pre_value = val_
224
224
 
225
- # 가장 마지막 데이터가 기준값과 동일한 경우
226
- if issame(val_, value):
227
- if mode == 'a':
228
- if repeat_num >= repeat:
229
- start_idx_list.append(start_idx)
230
- # 현재 위치 index 를 구간 끝 index 로 저장
231
- end_idx_list.append(idx)
232
- elif mode == 'b':
233
- if repeat_num <= repeat:
234
- start_idx_list.append(start_idx)
235
- end_idx_list.append(idx)
236
- elif mode == 'e':
237
- if repeat_num == repeat:
238
- start_idx_list.append(start_idx)
239
- end_idx_list.append(idx)
240
- else:
241
- raise KeyError('mode 를 a (above:이상), b (below:이하) 또는 e (equal:동일) 중 하나로 지정해주세요')
242
- # 가장 마지막 데이터가 기준값과 다르면 반복 계산할 필요 없음
225
+ # # 가장 마지막 데이터가 기준값과 동일한 경우
226
+ # if issame(val_, value):
227
+ # if mode == 'a':
228
+ # if repeat_num >= repeat:
229
+ # start_idx_list.append(start_idx)
230
+ # # 현재 위치 index 를 구간 끝 index 로 저장
231
+ # end_idx_list.append(idx)
232
+ # elif mode == 'b':
233
+ # if repeat_num <= repeat:
234
+ # start_idx_list.append(start_idx)
235
+ # end_idx_list.append(idx)
236
+ # elif mode == 'e':
237
+ # if repeat_num == repeat:
238
+ # start_idx_list.append(start_idx)
239
+ # end_idx_list.append(idx)
240
+ # else:
241
+ # raise KeyError('mode 를 a (above:이상), b (below:이하) 또는 e (equal:동일) 중 하나로 지정해주세요')
242
+ # # 가장 마지막 데이터가 기준값과 다르면 반복 계산할 필요 없음
243
243
 
244
- # 반전
245
- if reverse:
246
- rev_start_idx_list = [0]
247
- rev_end_idx_list = [len(ary)-1]
248
- for ns_idx, ne_idx in zip(start_idx_list, end_idx_list):
249
- if ns_idx == 0:
250
- rev_start_idx_list.pop(0)
251
- rev_start_idx_list.append(ne_idx+1)
252
- continue
253
- if ne_idx == len(ary)-1:
254
- rev_end_idx_list.pop(-1)
255
- rev_end_idx_list.append(ns_idx-1)
256
- continue
257
- rev_start_idx_list.append(ne_idx+1)
258
- rev_end_idx_list.insert(-1, ns_idx-1)
244
+ # # 반전
245
+ # if reverse:
246
+ # rev_start_idx_list = [0]
247
+ # rev_end_idx_list = [len(ary)-1]
248
+ # for ns_idx, ne_idx in zip(start_idx_list, end_idx_list):
249
+ # if ns_idx == 0:
250
+ # rev_start_idx_list.pop(0)
251
+ # rev_start_idx_list.append(ne_idx+1)
252
+ # continue
253
+ # if ne_idx == len(ary)-1:
254
+ # rev_end_idx_list.pop(-1)
255
+ # rev_end_idx_list.append(ns_idx-1)
256
+ # continue
257
+ # rev_start_idx_list.append(ne_idx+1)
258
+ # rev_end_idx_list.insert(-1, ns_idx-1)
259
259
 
260
- start_idx_list = rev_start_idx_list.copy()
261
- end_idx_list = rev_end_idx_list.copy()
260
+ # start_idx_list = rev_start_idx_list.copy()
261
+ # end_idx_list = rev_end_idx_list.copy()
262
262
 
263
- # 결과 정리
264
- result = []
265
- for si, ei in zip(start_idx_list, end_idx_list):
266
- result.append((si, ei))
263
+ # # 결과 정리
264
+ # result = []
265
+ # for si, ei in zip(start_idx_list, end_idx_list):
266
+ # result.append((si, ei))
267
267
 
268
- return result
268
+ # return result
269
269
 
270
270
 
271
271
 
@@ -501,4 +501,41 @@ def get_section(data, repeat, mode='a', key=None,
501
501
  rev_result[f'{k}_rev'] = rev_section
502
502
  return rev_result
503
503
 
504
- return result
504
+ return result
505
+
506
+
507
+ def section_union(main_section, sub_section, mode):
508
+
509
+ if len(main_section) == 0 or len(sub_section) == 0:
510
+ return main_section
511
+
512
+ m_min_idx = main_section[0][0]
513
+ m_max_idx = main_section[-1][1]
514
+ s_min_idx = sub_section[0][0]
515
+ s_max_idx = sub_section[-1][1]
516
+
517
+ max_idx = max([m_max_idx, s_max_idx])
518
+
519
+ main_ary = np.zeros(max_idx+1)
520
+ sub_ary = np.zeros(max_idx+1)
521
+
522
+ for m_sec in main_section:
523
+ main_ary[m_sec[0]:m_sec[1]+1] = -1
524
+
525
+ for s_sec in sub_section:
526
+ sub_ary[s_sec[0]:s_sec[1]+1] = 100
527
+
528
+ whole_ary = main_ary + sub_ary
529
+ if mode == '-':
530
+ com_ary = np.where(whole_ary==-1, 1, 0)
531
+ elif mode == '+':
532
+ com_ary = np.where((whole_ary>=99) | (whole_ary<=-1), 1, 0)
533
+ elif mode == '&':
534
+ com_ary = np.where(whole_ary==99, 1, 0)
535
+ new_section = rpu.get_section(
536
+ data=com_ary,
537
+ repeat=2,
538
+ key=1
539
+ )
540
+ section_list = list(new_section.values())[0]
541
+ return section_list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: utilskit
3
- Version: 0.2.11
3
+ Version: 0.2.13
4
4
  Summary: 다양한 편의성 함수 모음 패키지
5
5
  Author-email: kimyh <kim_yh663927@naver.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -17,6 +17,10 @@ Requires-Dist: tqdm==4.67.1
17
17
  Requires-Dist: xlrd==2.0.2
18
18
  Requires-Dist: openpyxl==3.1.5
19
19
 
20
+ # 0.2.13
21
+ - repeatutils 에 section_union 함수 추가
22
+ # 0.2.12
23
+ - dataframeutils 의 fill_repeat_nan 함수가 NaN 이 딱 하나만 있는 경우 보정하지 못하는 현상 수정
20
24
  # 0.2.11
21
25
  - dataframeutils 의 fill_repeat_nan 함수가 3 이하 반복되는 NaN 이 아닌 3 이상 반복되는 NaN 구간에 대해 보정하는 현상 수정
22
26
  # 0.2.10
File without changes
File without changes