utilskit 0.1.0__tar.gz → 0.1.2__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.
- {utilskit-0.1.0 → utilskit-0.1.2}/PKG-INFO +7 -2
- utilskit-0.1.2/README.md +6 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/setup.py +1 -1
- utilskit-0.1.2/utilskit/__init__.py +7 -0
- utilskit-0.1.2/utilskit/classificationutils/__init__.py +1 -0
- {utilskit-0.1.0/utilskit → utilskit-0.1.2/utilskit/classificationutils}/classificationutils.py +1 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit/dataframeutils.py +87 -32
- utilskit-0.1.2/utilskit/repeatutils.py +251 -0
- utilskit-0.1.2/utilskit/utils.py +151 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit.egg-info/PKG-INFO +7 -2
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit.egg-info/SOURCES.txt +4 -2
- utilskit-0.1.0/README.md +0 -1
- utilskit-0.1.0/utilskit/__init__.py +0 -7
- utilskit-0.1.0/utilskit/utils.py +0 -277
- {utilskit-0.1.0 → utilskit-0.1.2}/MANIFEST.in +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/setup.cfg +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit/dbutils.py +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit/logutils.py +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit/plotutils.py +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit/timeutils.py +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit.egg-info/dependency_links.txt +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/utilskit.egg-info/requires.txt +0 -0
- {utilskit-0.1.0 → utilskit-0.1.2}/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.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: description
|
|
5
5
|
Author: Kimyh
|
|
6
6
|
Author-email: kim_yh663927@naver.com
|
|
@@ -24,4 +24,9 @@ Dynamic: requires-dist
|
|
|
24
24
|
Dynamic: requires-python
|
|
25
25
|
Dynamic: summary
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
0.1.2
|
|
28
|
+
- repeatutils 의 get_repeat_section 에서 하나의 값이 여러 구간에서 반복될때 마지막 구간만 나오는 부분 수정
|
|
29
|
+
- repeatutils 의 get_repeat_section 및 get_stan_repeat_section 에서 추출되는 구간의 마지막 값이 +1 이 되는 부분 수정
|
|
30
|
+
0.1.1
|
|
31
|
+
repeatutils.py 추가
|
|
32
|
+
utils.py 에서 repeat 관련 함수 제거
|
utilskit-0.1.2/README.md
ADDED
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="utilskit", # 패키지 이름 (pip install 시 사용될 이름)
|
|
5
|
-
version="0.1.
|
|
5
|
+
version="0.1.2", # 버전
|
|
6
6
|
packages=find_packages(), # textbasic 폴더 내 모든 패키지 포함
|
|
7
7
|
include_package_data=True, # 이 설정을 통해 패키지 내 데이터 파일을 포함시킬 수 있음
|
|
8
8
|
package_data={
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .classificationutils import *
|
|
@@ -113,7 +113,6 @@ def adnormal2nan(df, stan_col, max_value=None, min_value=None):
|
|
|
113
113
|
def time_filling(df, start, end, time_column='time'):
|
|
114
114
|
if df.empty:
|
|
115
115
|
return df
|
|
116
|
-
|
|
117
116
|
time_range = pd.date_range(start=start, end=end, freq='S')
|
|
118
117
|
time_range_df = pd.DataFrame(time_range, columns=[time_column])
|
|
119
118
|
time_range_df = time_range_df.astype('str')
|
|
@@ -160,6 +159,92 @@ def local_nan_correction(df, stan_col, nan_repeat=5):
|
|
|
160
159
|
return df
|
|
161
160
|
|
|
162
161
|
|
|
162
|
+
# def pin_nan_correction(df, stan_col, max_diff=0.1, nan_repeat=3):
|
|
163
|
+
# '''
|
|
164
|
+
# 이상치 범위에 속하지 않지만
|
|
165
|
+
# 데이터 흐름상 이상치로 볼 필요가 있는 국소 범위의 값들을 결측치로 변경하는 함수
|
|
166
|
+
|
|
167
|
+
# 예시: 20, 20, 20, 20, [ 1], 20, 20, 20, 1, 1, 2, 1
|
|
168
|
+
# 결과: 20, 20, 20, 20, [NaN], 20, 20, 20, 1, 1, 2, 1
|
|
169
|
+
# '''
|
|
170
|
+
|
|
171
|
+
# # 기준 컬럼 데이터 추출
|
|
172
|
+
# stan_ary = df[stan_col].values
|
|
173
|
+
|
|
174
|
+
# # 현재 값에서 이전값을 뺀 데이터 ary 를 생성
|
|
175
|
+
# stan_1_list = stan_ary.tolist()
|
|
176
|
+
# stan_1_list.insert(0, stan_ary[0])
|
|
177
|
+
# stan_1_ary = np.array(stan_1_list)[:-1]
|
|
178
|
+
# diff_ary = np.round(stan_ary - stan_1_ary, 4)
|
|
179
|
+
# diff_ary = np.array(list(map(abs, diff_ary)))
|
|
180
|
+
|
|
181
|
+
# #==
|
|
182
|
+
# # print()
|
|
183
|
+
# idx_list = []
|
|
184
|
+
# for idx, diff in enumerate(diff_ary):
|
|
185
|
+
|
|
186
|
+
# # 앞뒤 차이값이 최대 차이값 보다 작은 경우
|
|
187
|
+
# if diff < max_diff:
|
|
188
|
+
# continue
|
|
189
|
+
|
|
190
|
+
# # idx 위치 이전 10개 데이터에 대한 평균
|
|
191
|
+
# before_aver = np.average(stan_ary[idx-10:idx])
|
|
192
|
+
|
|
193
|
+
# # idx 위치 이후 10개 데이터에 대한 평균
|
|
194
|
+
# after_aver = np.average(stan_ary[idx+1:idx+11])
|
|
195
|
+
|
|
196
|
+
# # 구간 내 nan 이 존재하는 경우 앞뒤 평균을 동일시
|
|
197
|
+
# if str(before_aver) == 'nan':
|
|
198
|
+
# before_aver = after_aver
|
|
199
|
+
# if str(after_aver) == 'nan':
|
|
200
|
+
# after_aver = before_aver
|
|
201
|
+
|
|
202
|
+
# # 앞뒤 평균값 간의 차이값 절대값 계산
|
|
203
|
+
# aver_diff = abs(after_aver - before_aver)
|
|
204
|
+
|
|
205
|
+
# # 바로 앞 뒤의 차이값과 평균값 간 차이값의 차이값 p 계산
|
|
206
|
+
# p = np.round(diff - aver_diff, 4)
|
|
207
|
+
|
|
208
|
+
# # p 가 최대 차이값 보다 큰 경우 이상치로 판단
|
|
209
|
+
# if p > max_diff:
|
|
210
|
+
# idx_list.append(idx)
|
|
211
|
+
|
|
212
|
+
# # print(f'{idx:5d}, {before_aver:.2f}, {diff:.2f}, {after_aver:.2f}, {aver_diff:.2f}')
|
|
213
|
+
# # print(p)
|
|
214
|
+
# # print(idx_list)
|
|
215
|
+
# del idx
|
|
216
|
+
|
|
217
|
+
# # pin idx 가 존재하는 경우 해당 범위를 nan 으로 대체
|
|
218
|
+
# temp_ary = stan_ary.copy()
|
|
219
|
+
# if len(idx_list) > 0:
|
|
220
|
+
# for idx in idx_list:
|
|
221
|
+
# if idx < 3:
|
|
222
|
+
# temp_ary[:idx+3] = np.nan
|
|
223
|
+
# else:
|
|
224
|
+
# temp_ary[idx-3:idx+3] = np.nan
|
|
225
|
+
|
|
226
|
+
# # nan 의 위치 구하기
|
|
227
|
+
# for_fill_start_idx_list, for_fill_end_idx_list = u.identify_stan_repeat_section(
|
|
228
|
+
# ary=temp_ary,
|
|
229
|
+
# stan_value='nan',
|
|
230
|
+
# stan_repeat=nan_repeat,
|
|
231
|
+
# mode='below',
|
|
232
|
+
# reverse=False
|
|
233
|
+
# )
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
# # 해당 부분을 NaN 값으로 변환
|
|
237
|
+
# for fsi, fei in zip(for_fill_start_idx_list, for_fill_end_idx_list):
|
|
238
|
+
# df.loc[fsi:fei, stan_col] = np.nan
|
|
239
|
+
# df.loc[fsi-1:fei, stan_col] = df.loc[fsi-1:fei, stan_col].fillna(method='ffill')
|
|
240
|
+
# df.loc[fsi:fei+1, stan_col] = df.loc[fsi:fei+1, stan_col].fillna(method='bfill')
|
|
241
|
+
|
|
242
|
+
# return df
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
163
248
|
def pin_nan_correction(df, stan_col, max_diff=0.1, nan_repeat=3):
|
|
164
249
|
'''
|
|
165
250
|
이상치 범위에 속하지 않지만
|
|
@@ -214,36 +299,6 @@ def pin_nan_correction(df, stan_col, max_diff=0.1, nan_repeat=3):
|
|
|
214
299
|
# print(p)
|
|
215
300
|
# print(idx_list)
|
|
216
301
|
del idx
|
|
217
|
-
# idx_list = [0, 1, 11094, 11095, 12894, 12895, 12896, 12897, 35710, 35711]
|
|
218
|
-
# for i in idx_list:
|
|
219
|
-
# print(stan_ary[i])
|
|
220
|
-
# del i
|
|
221
|
-
#==
|
|
222
|
-
|
|
223
|
-
# print('-----------------------------------------')
|
|
224
|
-
# print(np.round(stan_ary[0:10], 4).tolist())
|
|
225
|
-
# print(np.round(stan_1_ary[0:10], 4).tolist())
|
|
226
|
-
# print(np.round(diff_ary[0:10], 4).tolist())
|
|
227
|
-
|
|
228
|
-
# print('-----------------------------------------')
|
|
229
|
-
# print(np.round(stan_ary[11090:11100], 4).tolist())
|
|
230
|
-
# print(np.round(stan_1_ary[11090:11100], 4).tolist())
|
|
231
|
-
# print(np.round(diff_ary[11090:11100], 4).tolist())
|
|
232
|
-
|
|
233
|
-
# print('-----------------------------------------')
|
|
234
|
-
# print(np.round(stan_ary[12890:12900], 4).tolist())
|
|
235
|
-
# print(np.round(stan_1_ary[12890:12900], 4).tolist())
|
|
236
|
-
# print(np.round(diff_ary[12890:12900], 4).tolist())
|
|
237
|
-
|
|
238
|
-
# print('-----------------------------------------')
|
|
239
|
-
# print(np.round(stan_ary[17945:17955], 4).tolist())
|
|
240
|
-
# print(np.round(stan_1_ary[17945:17955], 4).tolist())
|
|
241
|
-
# print(np.round(diff_ary[17945:17955], 4).tolist())
|
|
242
|
-
|
|
243
|
-
# print('-----------------------------------------')
|
|
244
|
-
# print(np.round(stan_ary[-10:], 4).tolist())
|
|
245
|
-
# print(np.round(stan_1_ary[-10:], 4).tolist())
|
|
246
|
-
# print(np.round(diff_ary[-10:], 4).tolist())
|
|
247
302
|
|
|
248
303
|
# pin idx 가 존재하는 경우 해당 범위를 nan 으로 대체
|
|
249
304
|
temp_ary = stan_ary.copy()
|
|
@@ -255,7 +310,7 @@ def pin_nan_correction(df, stan_col, max_diff=0.1, nan_repeat=3):
|
|
|
255
310
|
temp_ary[idx-3:idx+3] = np.nan
|
|
256
311
|
|
|
257
312
|
# nan 의 위치 구하기
|
|
258
|
-
for_fill_start_idx_list, for_fill_end_idx_list =
|
|
313
|
+
for_fill_start_idx_list, for_fill_end_idx_list = um.identify_stan_repeat_section(
|
|
259
314
|
ary=temp_ary,
|
|
260
315
|
stan_value='nan',
|
|
261
316
|
stan_repeat=nan_repeat,
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def issame(value1, value2):
|
|
7
|
+
# 서로 같은 경우
|
|
8
|
+
if value1 == value2:
|
|
9
|
+
return True
|
|
10
|
+
# 서로 다른 경우
|
|
11
|
+
else:
|
|
12
|
+
# 어느 한 쪽 이라도 str type 인 경우
|
|
13
|
+
if isinstance(value1, str) or isinstance(value2, str):
|
|
14
|
+
if str(value1) == str(value2):
|
|
15
|
+
return True # ex) value1 = 1, value2 = '1'
|
|
16
|
+
else:
|
|
17
|
+
return False # ex) value1 = 1, value2 = 'nan'
|
|
18
|
+
# 어느 한 쪽이라도 str type 이 아닌 경우
|
|
19
|
+
else:
|
|
20
|
+
# value1 이 NaN 일때
|
|
21
|
+
if np.isnan(value1):
|
|
22
|
+
# value2 도 NaN 이면
|
|
23
|
+
if np.isnan(value2):
|
|
24
|
+
return True
|
|
25
|
+
# value2 가 NaN 이 아니면
|
|
26
|
+
else:
|
|
27
|
+
return False
|
|
28
|
+
else:
|
|
29
|
+
return False
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# def get_repeat_section2(data, repeat_num, refer_value=None, except_nan=True):
|
|
33
|
+
# '''
|
|
34
|
+
# '''
|
|
35
|
+
# raw_ary = np.array(data)
|
|
36
|
+
# ary = raw_ary.copy()
|
|
37
|
+
# same_tf = (ary[:-1] == ary[1:])
|
|
38
|
+
# is_nan = np.isnan(ary)
|
|
39
|
+
|
|
40
|
+
# for i, j, k, l in zip(ary[:-1], ary[1:], same_tf, is_nan):
|
|
41
|
+
# print(i, j, k, l)
|
|
42
|
+
|
|
43
|
+
# a = np.where(same_tf==1)
|
|
44
|
+
# print(a)
|
|
45
|
+
|
|
46
|
+
# sys.exit()
|
|
47
|
+
|
|
48
|
+
# value_list = []
|
|
49
|
+
# start_idx_list = []
|
|
50
|
+
# end_idx_list = []
|
|
51
|
+
# start_idx = 0
|
|
52
|
+
# # pre_value = 'nan'
|
|
53
|
+
# repeat_num = 1
|
|
54
|
+
# for idx, value in enumerate(ary):
|
|
55
|
+
|
|
56
|
+
# # 가장 처음인 경우
|
|
57
|
+
# if idx == 0:
|
|
58
|
+
# pre_value = value
|
|
59
|
+
# continue
|
|
60
|
+
|
|
61
|
+
# # 현재 값이 이전 값과 동일할때
|
|
62
|
+
# if issame(value, pre_value):
|
|
63
|
+
# repeat_num += 1
|
|
64
|
+
|
|
65
|
+
# # 현재 값이 이전 값과 다를때
|
|
66
|
+
# else:
|
|
67
|
+
# if repeat_num >= stan_repeat:
|
|
68
|
+
# value_list.append(pre_value)
|
|
69
|
+
# start_idx_list.append(start_idx)
|
|
70
|
+
# end_idx_list.append(idx-1)
|
|
71
|
+
# # 시작 지점 갱신 & 반복횟수 초기화
|
|
72
|
+
# start_idx = idx
|
|
73
|
+
# repeat_num = 1
|
|
74
|
+
# pre_value = value
|
|
75
|
+
|
|
76
|
+
# # 마지막 값이 이전 값과 같을때
|
|
77
|
+
# if issame(value, pre_value):
|
|
78
|
+
# if repeat_num >= stan_repeat:
|
|
79
|
+
# value_list.append(value)
|
|
80
|
+
# start_idx_list.append(start_idx)
|
|
81
|
+
# end_idx_list.append(idx)
|
|
82
|
+
# # --------------------------------------
|
|
83
|
+
# # 함수 수정중
|
|
84
|
+
# # 결과 정리
|
|
85
|
+
# result = {'nan':None}
|
|
86
|
+
# for v, si, ei in zip(value_list, start_idx_list, end_idx_list):
|
|
87
|
+
# result[str(v)] = (si, ei)
|
|
88
|
+
# if except_nan:
|
|
89
|
+
# del result['nan']
|
|
90
|
+
# return result
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_repeat_section(ary, stan_repeat, except_nan=True):
|
|
95
|
+
'''
|
|
96
|
+
데이터 array 에서 정해놓은 반복 횟수 (stan_repeat) 만큼 반복되는 숫자구간이 있다면
|
|
97
|
+
그 구간의 시작, 끝 위치 index 값을 추출한다.
|
|
98
|
+
NaN 가 반복되는지 여부를 포함시킬 수 있다.
|
|
99
|
+
'''
|
|
100
|
+
value_list = []
|
|
101
|
+
start_idx_list = []
|
|
102
|
+
end_idx_list = []
|
|
103
|
+
start_idx = 0
|
|
104
|
+
# pre_value = 'nan'
|
|
105
|
+
repeat_num = 1
|
|
106
|
+
for idx, value in enumerate(ary):
|
|
107
|
+
|
|
108
|
+
# 가장 처음인 경우
|
|
109
|
+
if idx == 0:
|
|
110
|
+
pre_value = value
|
|
111
|
+
continue
|
|
112
|
+
|
|
113
|
+
# 현재 값이 이전 값과 동일할때
|
|
114
|
+
if issame(value, pre_value):
|
|
115
|
+
repeat_num += 1
|
|
116
|
+
|
|
117
|
+
# 현재 값이 이전 값과 다를때
|
|
118
|
+
else:
|
|
119
|
+
if repeat_num >= stan_repeat:
|
|
120
|
+
value_list.append(pre_value)
|
|
121
|
+
start_idx_list.append(start_idx)
|
|
122
|
+
end_idx_list.append(idx-1)
|
|
123
|
+
# 시작 지점 갱신 & 반복횟수 초기화
|
|
124
|
+
start_idx = idx
|
|
125
|
+
repeat_num = 1
|
|
126
|
+
|
|
127
|
+
pre_value = value
|
|
128
|
+
|
|
129
|
+
# 마지막 값이 이전 값과 같을때
|
|
130
|
+
if issame(value, pre_value):
|
|
131
|
+
if repeat_num >= stan_repeat:
|
|
132
|
+
value_list.append(value)
|
|
133
|
+
start_idx_list.append(start_idx)
|
|
134
|
+
end_idx_list.append(idx)
|
|
135
|
+
# --------------------------------------
|
|
136
|
+
# 함수 수정중
|
|
137
|
+
# 결과 정리
|
|
138
|
+
# print(value_list)
|
|
139
|
+
# sys.exit()
|
|
140
|
+
result = {}
|
|
141
|
+
for v, si, ei in zip(value_list, start_idx_list, end_idx_list):
|
|
142
|
+
try:
|
|
143
|
+
result[str(v)].append((si, ei))
|
|
144
|
+
except KeyError:
|
|
145
|
+
result[str(v)] = [(si, ei)]
|
|
146
|
+
if except_nan:
|
|
147
|
+
del result['nan']
|
|
148
|
+
return result
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def get_stan_repeat_section(ary, stan_value, stan_repeat, mode, reverse=False):
|
|
152
|
+
'''
|
|
153
|
+
ary 에서 기준값(stan_value)이 지정한 횟수(stan_repeat)
|
|
154
|
+
이상(above) 또는 이하(below) 만큼 반복되는 구간의 시작, 끝 위치 index 값을 추출하는 함수
|
|
155
|
+
reverse 를 True 로 지정하면 해당 각 구간의 끝->시작, 시작->끝 으로 반전된다.
|
|
156
|
+
mode 는 a (above) 와 b (below)만 존재
|
|
157
|
+
'''
|
|
158
|
+
start_idx = 0
|
|
159
|
+
start_idx_list = []
|
|
160
|
+
end_idx_list = []
|
|
161
|
+
repeat_num = 1
|
|
162
|
+
|
|
163
|
+
if len(ary) == 0:
|
|
164
|
+
return [], []
|
|
165
|
+
|
|
166
|
+
# stan_value = float(stan_value)
|
|
167
|
+
for idx, value in enumerate(ary):
|
|
168
|
+
|
|
169
|
+
# 가장 처음인 경우
|
|
170
|
+
if idx == 0:
|
|
171
|
+
pre_value = value
|
|
172
|
+
continue
|
|
173
|
+
|
|
174
|
+
# 현재 값이 기준값(stan_value) 인 경우
|
|
175
|
+
if issame(value, stan_value):
|
|
176
|
+
# 이전값이 기준값과 동일하면
|
|
177
|
+
if issame(pre_value, stan_value):
|
|
178
|
+
# 반복횟수 +1
|
|
179
|
+
repeat_num += 1
|
|
180
|
+
# 이전 값이 기준값과 다르면
|
|
181
|
+
else:
|
|
182
|
+
# 반복횟수 초기화
|
|
183
|
+
repeat_num = 1
|
|
184
|
+
# 현재 위치를 시작로 위치 지정
|
|
185
|
+
start_idx = idx
|
|
186
|
+
# 현재 값이 기준값과 다른 경우
|
|
187
|
+
else:
|
|
188
|
+
# 이전 값이 기준값과 동일하면
|
|
189
|
+
if issame(pre_value, stan_value):
|
|
190
|
+
# idx 끝 위치 지정
|
|
191
|
+
|
|
192
|
+
# 반복 횟수 기준 이상인 경우
|
|
193
|
+
if mode == 'a':
|
|
194
|
+
# 기록된 반복 횟수가 기준 횟수 이상이면
|
|
195
|
+
if repeat_num >= stan_repeat:
|
|
196
|
+
# 지정해둔 시작 위치 index 값을 구간시작 index 로 저장
|
|
197
|
+
start_idx_list.append(start_idx)
|
|
198
|
+
# 현재 위치 바로 이전 위치 index 값을 구간끝 index 로 저장
|
|
199
|
+
end_idx_list.append(idx-1)
|
|
200
|
+
# 반복 횟수 기준 이하인 경우
|
|
201
|
+
elif mode == 'b':
|
|
202
|
+
# 기록된 반복 횟수가 기준 횟수 이하면
|
|
203
|
+
if repeat_num <= stan_repeat:
|
|
204
|
+
start_idx_list.append(start_idx)
|
|
205
|
+
end_idx_list.append(idx-1)
|
|
206
|
+
else:
|
|
207
|
+
print('mode 를 a (above:이상) 또는 b (below:이하) 중 하나로 지정해주세요')
|
|
208
|
+
raise KeyError()
|
|
209
|
+
# 현재 위치 값을 이전 위치로 저장
|
|
210
|
+
pre_value = value
|
|
211
|
+
|
|
212
|
+
# 가장 마지막 데이터가 기준값과 동일한 경우
|
|
213
|
+
if issame(value, stan_value):
|
|
214
|
+
if mode == 'a':
|
|
215
|
+
if repeat_num >= stan_repeat:
|
|
216
|
+
start_idx_list.append(start_idx)
|
|
217
|
+
# 현재 위치 index 를 구간 끝 index 로 저장
|
|
218
|
+
end_idx_list.append(idx)
|
|
219
|
+
elif mode == 'b':
|
|
220
|
+
if repeat_num <= stan_repeat:
|
|
221
|
+
start_idx_list.append(start_idx)
|
|
222
|
+
end_idx_list.append(idx)
|
|
223
|
+
else:
|
|
224
|
+
raise KeyError('mode 를 a (above:이상) 또는 b (below:이하) 중 하나로 지정해주세요')
|
|
225
|
+
# 가장 마지막 데이터가 기준값과 다르면 반복 계산할 필요 없음
|
|
226
|
+
|
|
227
|
+
# 반전
|
|
228
|
+
if reverse:
|
|
229
|
+
rev_start_idx_list = [0]
|
|
230
|
+
rev_end_idx_list = [len(ary)-1]
|
|
231
|
+
for ns_idx, ne_idx in zip(start_idx_list, end_idx_list):
|
|
232
|
+
if ns_idx == 0:
|
|
233
|
+
rev_start_idx_list.pop(0)
|
|
234
|
+
rev_start_idx_list.append(ne_idx+1)
|
|
235
|
+
continue
|
|
236
|
+
if ne_idx == len(ary)-1:
|
|
237
|
+
rev_end_idx_list.pop(-1)
|
|
238
|
+
rev_end_idx_list.append(ns_idx-1)
|
|
239
|
+
continue
|
|
240
|
+
rev_start_idx_list.append(ne_idx+1)
|
|
241
|
+
rev_end_idx_list.insert(-1, ns_idx-1)
|
|
242
|
+
|
|
243
|
+
start_idx_list = rev_start_idx_list.copy()
|
|
244
|
+
end_idx_list = rev_end_idx_list.copy()
|
|
245
|
+
|
|
246
|
+
# 결과 정리
|
|
247
|
+
result = []
|
|
248
|
+
for si, ei in zip(start_idx_list, end_idx_list):
|
|
249
|
+
result.append((si, ei))
|
|
250
|
+
|
|
251
|
+
return result
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'''
|
|
2
|
+
pip install xlrd
|
|
3
|
+
'''
|
|
4
|
+
import numpy as np
|
|
5
|
+
import pandas as pd
|
|
6
|
+
import shutil
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
import json
|
|
10
|
+
import time
|
|
11
|
+
import csv
|
|
12
|
+
from tqdm import tqdm
|
|
13
|
+
from datetime import date, datetime, timedelta
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def save_yaml(path, obj):
|
|
17
|
+
import yaml
|
|
18
|
+
with open(path, 'w') as f:
|
|
19
|
+
yaml.dump(obj, f, sort_keys=False)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def load_yaml(path):
|
|
23
|
+
import yaml
|
|
24
|
+
with open(path, 'r') as f:
|
|
25
|
+
return yaml.load(f, Loader=yaml.FullLoader)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def envs_setting(random_seed):
|
|
29
|
+
'''
|
|
30
|
+
난수지정 등의 환경설정
|
|
31
|
+
|
|
32
|
+
parameters
|
|
33
|
+
----------
|
|
34
|
+
random_seed: int
|
|
35
|
+
설정할 random seed
|
|
36
|
+
|
|
37
|
+
returns
|
|
38
|
+
-------
|
|
39
|
+
torch, numpy, random 등에 대한 랜덤 시드 고정
|
|
40
|
+
'''
|
|
41
|
+
|
|
42
|
+
import torch
|
|
43
|
+
import torch.backends.cudnn as cudnn
|
|
44
|
+
import random
|
|
45
|
+
import numpy as np
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# seed
|
|
49
|
+
torch.manual_seed(random_seed)
|
|
50
|
+
torch.cuda.manual_seed(random_seed)
|
|
51
|
+
torch.cuda.manual_seed_all(random_seed)
|
|
52
|
+
cudnn.benchmark = False
|
|
53
|
+
cudnn.deterministic = True
|
|
54
|
+
np.random.seed(random_seed)
|
|
55
|
+
random.seed(random_seed)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def normalize_1D(ary):
|
|
60
|
+
'''
|
|
61
|
+
1차원데이터를 0~1 사이 값으로 normalize 하는 함수
|
|
62
|
+
|
|
63
|
+
parameters
|
|
64
|
+
----------
|
|
65
|
+
ary: numpy array
|
|
66
|
+
noramlize 를 적용할 1차원 array
|
|
67
|
+
|
|
68
|
+
returns
|
|
69
|
+
-------
|
|
70
|
+
0 ~ 1 사이로 noramalize 된 array
|
|
71
|
+
'''
|
|
72
|
+
ary = np.array(ary)
|
|
73
|
+
|
|
74
|
+
if len(ary.shape) > 1:
|
|
75
|
+
return print('1 차원 데이터만 입력 가능')
|
|
76
|
+
|
|
77
|
+
ary_min = np.min(ary)
|
|
78
|
+
ary_min = np.subtract(ary, ary_min)
|
|
79
|
+
ary_max = np.max(ary_min)
|
|
80
|
+
ary_norm = np.divide(ary_min, ary_max)
|
|
81
|
+
|
|
82
|
+
return ary_norm
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def get_error_info():
|
|
86
|
+
import traceback
|
|
87
|
+
traceback_string = traceback.format_exc()
|
|
88
|
+
return traceback_string
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def read_jsonl(data_path):
|
|
92
|
+
try:
|
|
93
|
+
data_list = validate_data(
|
|
94
|
+
data_path=data_path,
|
|
95
|
+
encoding='utf-8-sig'
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
except UnicodeDecodeError:
|
|
99
|
+
|
|
100
|
+
data_list = validate_data(
|
|
101
|
+
data_path=data_path,
|
|
102
|
+
encoding='cp949'
|
|
103
|
+
)
|
|
104
|
+
return data_list
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def validate_data(data_path, encoding):
|
|
108
|
+
data_list = []
|
|
109
|
+
try:
|
|
110
|
+
with open(data_path, 'r', encoding=encoding) as f:
|
|
111
|
+
prodigy_data_list = json.load(f)
|
|
112
|
+
data_list.append(prodigy_data_list)
|
|
113
|
+
except json.decoder.JSONDecodeError:
|
|
114
|
+
with open(data_path, 'r', encoding=encoding) as f:
|
|
115
|
+
for line in f:
|
|
116
|
+
line = line.replace('\n', '')
|
|
117
|
+
line.strip()
|
|
118
|
+
if line[-1] == '}':
|
|
119
|
+
json_line = json.loads(line)
|
|
120
|
+
data_list.append(json_line)
|
|
121
|
+
return data_list
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def tensor2array(x_tensor):
|
|
125
|
+
x_ary = x_tensor.detach().cpu().numpy()
|
|
126
|
+
return x_ary
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def save_tensor(x_tensor, mode):
|
|
130
|
+
x_ary = tensor2array(x_tensor=x_tensor)
|
|
131
|
+
|
|
132
|
+
if mode == 1:
|
|
133
|
+
b = x_ary[0]
|
|
134
|
+
# b = np.round(b, 3)
|
|
135
|
+
b = np.where(np.absolute(b) > 2, np.round(b, 0), np.round(b, 3))
|
|
136
|
+
df = pd.DataFrame(b)
|
|
137
|
+
df.to_csv(f'./temp.csv', index=False, encoding='utf-8-sig')
|
|
138
|
+
print(df)
|
|
139
|
+
print(x_ary.shape)
|
|
140
|
+
|
|
141
|
+
if mode == 2:
|
|
142
|
+
ary = x_ary[0]
|
|
143
|
+
i, j, k = ary.shape
|
|
144
|
+
print(i, j, k)
|
|
145
|
+
for idx in range(k):
|
|
146
|
+
a = np.squeeze(ary[:, :, idx:idx+1])
|
|
147
|
+
a = np.where(np.absolute(a) > 2, np.round(a, 0), np.round(a, 3))
|
|
148
|
+
df = pd.DataFrame(a)
|
|
149
|
+
df.to_csv(f'./temp{idx}.csv', index=False, encoding='utf-8-sig')
|
|
150
|
+
print(df)
|
|
151
|
+
print(x_ary.shape)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: utilskit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: description
|
|
5
5
|
Author: Kimyh
|
|
6
6
|
Author-email: kim_yh663927@naver.com
|
|
@@ -24,4 +24,9 @@ Dynamic: requires-dist
|
|
|
24
24
|
Dynamic: requires-python
|
|
25
25
|
Dynamic: summary
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
0.1.2
|
|
28
|
+
- repeatutils 의 get_repeat_section 에서 하나의 값이 여러 구간에서 반복될때 마지막 구간만 나오는 부분 수정
|
|
29
|
+
- repeatutils 의 get_repeat_section 및 get_stan_repeat_section 에서 추출되는 구간의 마지막 값이 +1 이 되는 부분 수정
|
|
30
|
+
0.1.1
|
|
31
|
+
repeatutils.py 추가
|
|
32
|
+
utils.py 에서 repeat 관련 함수 제거
|
|
@@ -2,15 +2,17 @@ MANIFEST.in
|
|
|
2
2
|
README.md
|
|
3
3
|
setup.py
|
|
4
4
|
utilskit/__init__.py
|
|
5
|
-
utilskit/classificationutils.py
|
|
6
5
|
utilskit/dataframeutils.py
|
|
7
6
|
utilskit/dbutils.py
|
|
8
7
|
utilskit/logutils.py
|
|
9
8
|
utilskit/plotutils.py
|
|
9
|
+
utilskit/repeatutils.py
|
|
10
10
|
utilskit/timeutils.py
|
|
11
11
|
utilskit/utils.py
|
|
12
12
|
utilskit.egg-info/PKG-INFO
|
|
13
13
|
utilskit.egg-info/SOURCES.txt
|
|
14
14
|
utilskit.egg-info/dependency_links.txt
|
|
15
15
|
utilskit.egg-info/requires.txt
|
|
16
|
-
utilskit.egg-info/top_level.txt
|
|
16
|
+
utilskit.egg-info/top_level.txt
|
|
17
|
+
utilskit/classificationutils/__init__.py
|
|
18
|
+
utilskit/classificationutils/classificationutils.py
|
utilskit-0.1.0/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
baseline
|
utilskit-0.1.0/utilskit/utils.py
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
'''
|
|
2
|
-
pip install xlrd
|
|
3
|
-
'''
|
|
4
|
-
import numpy as np
|
|
5
|
-
import pandas as pd
|
|
6
|
-
import shutil
|
|
7
|
-
import os
|
|
8
|
-
import sys
|
|
9
|
-
import json
|
|
10
|
-
import time
|
|
11
|
-
import csv
|
|
12
|
-
from tqdm import tqdm
|
|
13
|
-
from datetime import date, datetime, timedelta
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def save_yaml(path, obj):
|
|
17
|
-
import yaml
|
|
18
|
-
with open(path, 'w') as f:
|
|
19
|
-
yaml.dump(obj, f, sort_keys=False)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def load_yaml(path):
|
|
23
|
-
import yaml
|
|
24
|
-
with open(path, 'r') as f:
|
|
25
|
-
return yaml.load(f, Loader=yaml.FullLoader)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def envs_setting(random_seed):
|
|
29
|
-
'''
|
|
30
|
-
난수지정 등의 환경설정
|
|
31
|
-
|
|
32
|
-
parameters
|
|
33
|
-
----------
|
|
34
|
-
random_seed: int
|
|
35
|
-
설정할 random seed
|
|
36
|
-
|
|
37
|
-
returns
|
|
38
|
-
-------
|
|
39
|
-
torch, numpy, random 등에 대한 랜덤 시드 고정
|
|
40
|
-
'''
|
|
41
|
-
|
|
42
|
-
import torch
|
|
43
|
-
import torch.backends.cudnn as cudnn
|
|
44
|
-
import random
|
|
45
|
-
import numpy as np
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# seed
|
|
49
|
-
torch.manual_seed(random_seed)
|
|
50
|
-
torch.cuda.manual_seed(random_seed)
|
|
51
|
-
torch.cuda.manual_seed_all(random_seed)
|
|
52
|
-
cudnn.benchmark = False
|
|
53
|
-
cudnn.deterministic = True
|
|
54
|
-
np.random.seed(random_seed)
|
|
55
|
-
random.seed(random_seed)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def normalize_1D(ary):
|
|
60
|
-
'''
|
|
61
|
-
1차원데이터를 0~1 사이 값으로 normalize 하는 함수
|
|
62
|
-
|
|
63
|
-
parameters
|
|
64
|
-
----------
|
|
65
|
-
ary: numpy array
|
|
66
|
-
noramlize 를 적용할 1차원 array
|
|
67
|
-
|
|
68
|
-
returns
|
|
69
|
-
-------
|
|
70
|
-
0 ~ 1 사이로 noramalize 된 array
|
|
71
|
-
'''
|
|
72
|
-
ary = np.array(ary)
|
|
73
|
-
|
|
74
|
-
if len(ary.shape) > 1:
|
|
75
|
-
return print('1 차원 데이터만 입력 가능')
|
|
76
|
-
|
|
77
|
-
ary_min = np.min(ary)
|
|
78
|
-
ary_min = np.subtract(ary, ary_min)
|
|
79
|
-
ary_max = np.max(ary_min)
|
|
80
|
-
ary_norm = np.divide(ary_min, ary_max)
|
|
81
|
-
|
|
82
|
-
return ary_norm
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def get_error_info():
|
|
86
|
-
import traceback
|
|
87
|
-
traceback_string = traceback.format_exc()
|
|
88
|
-
return traceback_string
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def read_jsonl(data_path):
|
|
92
|
-
try:
|
|
93
|
-
data_list = validate_data(
|
|
94
|
-
data_path=data_path,
|
|
95
|
-
encoding='utf-8-sig'
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
except UnicodeDecodeError:
|
|
99
|
-
|
|
100
|
-
data_list = validate_data(
|
|
101
|
-
data_path=data_path,
|
|
102
|
-
encoding='cp949'
|
|
103
|
-
)
|
|
104
|
-
return data_list
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def validate_data(data_path, encoding):
|
|
108
|
-
data_list = []
|
|
109
|
-
try:
|
|
110
|
-
with open(data_path, 'r', encoding=encoding) as f:
|
|
111
|
-
prodigy_data_list = json.load(f)
|
|
112
|
-
data_list.append(prodigy_data_list)
|
|
113
|
-
except json.decoder.JSONDecodeError:
|
|
114
|
-
with open(data_path, 'r', encoding=encoding) as f:
|
|
115
|
-
for line in f:
|
|
116
|
-
line = line.replace('\n', '')
|
|
117
|
-
line.strip()
|
|
118
|
-
if line[-1] == '}':
|
|
119
|
-
json_line = json.loads(line)
|
|
120
|
-
data_list.append(json_line)
|
|
121
|
-
return data_list
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def tensor2array(x_tensor):
|
|
125
|
-
x_ary = x_tensor.detach().cpu().numpy()
|
|
126
|
-
return x_ary
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def save_tensor(x_tensor, mode):
|
|
130
|
-
x_ary = tensor2array(x_tensor=x_tensor)
|
|
131
|
-
|
|
132
|
-
if mode == 1:
|
|
133
|
-
b = x_ary[0]
|
|
134
|
-
# b = np.round(b, 3)
|
|
135
|
-
b = np.where(np.absolute(b) > 2, np.round(b, 0), np.round(b, 3))
|
|
136
|
-
df = pd.DataFrame(b)
|
|
137
|
-
df.to_csv(f'./temp.csv', index=False, encoding='utf-8-sig')
|
|
138
|
-
print(df)
|
|
139
|
-
print(x_ary.shape)
|
|
140
|
-
|
|
141
|
-
if mode == 2:
|
|
142
|
-
ary = x_ary[0]
|
|
143
|
-
i, j, k = ary.shape
|
|
144
|
-
print(i, j, k)
|
|
145
|
-
for idx in range(k):
|
|
146
|
-
a = np.squeeze(ary[:, :, idx:idx+1])
|
|
147
|
-
a = np.where(np.absolute(a) > 2, np.round(a, 0), np.round(a, 3))
|
|
148
|
-
df = pd.DataFrame(a)
|
|
149
|
-
df.to_csv(f'./temp{idx}.csv', index=False, encoding='utf-8-sig')
|
|
150
|
-
print(df)
|
|
151
|
-
print(x_ary.shape)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def identify_repeat_section(ary, stan_num, include_nan=False):
|
|
155
|
-
'''
|
|
156
|
-
데이터 array 에서 특정 숫자가 정해놓은 반복 횟수 (stan_repeat) 만큼 반복되면
|
|
157
|
-
그 구간의 시작, 끝 위치 index 값을 추출한다.
|
|
158
|
-
'''
|
|
159
|
-
start_idx_list = []
|
|
160
|
-
end_idx_list = []
|
|
161
|
-
start_idx = 0
|
|
162
|
-
# pre_value = 'nan'
|
|
163
|
-
flag = 1
|
|
164
|
-
for idx, value in enumerate(ary):
|
|
165
|
-
value_str = str(value)
|
|
166
|
-
|
|
167
|
-
# 가장 처음인 경우
|
|
168
|
-
if idx == 0:
|
|
169
|
-
pre_value = value_str
|
|
170
|
-
continue
|
|
171
|
-
|
|
172
|
-
# 현재 값이 이전 값과 동일할때
|
|
173
|
-
if value_str == pre_value:
|
|
174
|
-
# 현재 값이 nan 이 아닌 경우 만
|
|
175
|
-
|
|
176
|
-
if include_nan:
|
|
177
|
-
flag += 1
|
|
178
|
-
else:
|
|
179
|
-
if value_str != 'nan':
|
|
180
|
-
flag += 1
|
|
181
|
-
# 현재 값이 이전 값과 다를때
|
|
182
|
-
else:
|
|
183
|
-
if flag >= stan_num:
|
|
184
|
-
start_idx_list.append(start_idx)
|
|
185
|
-
end_idx_list.append(idx-1)
|
|
186
|
-
|
|
187
|
-
# 시작 지점 갱신
|
|
188
|
-
start_idx = idx
|
|
189
|
-
flag = 1
|
|
190
|
-
pre_value = value_str
|
|
191
|
-
|
|
192
|
-
if flag >= stan_num:
|
|
193
|
-
start_idx_list.append(start_idx)
|
|
194
|
-
end_idx_list.append(idx)
|
|
195
|
-
return start_idx_list, end_idx_list
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
def identify_stan_repeat_section(ary, stan_value, stan_repeat, mode, reverse=False):
|
|
199
|
-
'''
|
|
200
|
-
ary 에서 기준값(stan_value)이 지정한 횟수(stan_repeat)
|
|
201
|
-
이상(above) 또는 이하(below) 만큼 반복되는 구간의 시작, 끝 위치 index 값을 추출하는 함수
|
|
202
|
-
reverse 를 True 로 지정하면 해당 각 구간의 끝->시작, 시작->끝 으로 반전된다.
|
|
203
|
-
'''
|
|
204
|
-
nan_start_idx = 0
|
|
205
|
-
nan_start_idx_list = []
|
|
206
|
-
nan_end_idx_list = []
|
|
207
|
-
flag = 1
|
|
208
|
-
if len(ary) == 0:
|
|
209
|
-
return [], []
|
|
210
|
-
for idx, value in enumerate(ary):
|
|
211
|
-
|
|
212
|
-
value_str = str(value)
|
|
213
|
-
|
|
214
|
-
# 가장 처음인 경우
|
|
215
|
-
if idx == 0:
|
|
216
|
-
pre_value = value_str
|
|
217
|
-
continue
|
|
218
|
-
|
|
219
|
-
# 현재 값이 stan 일 때
|
|
220
|
-
if value_str == stan_value:
|
|
221
|
-
# 이전값이 nan 인경우
|
|
222
|
-
if pre_value == stan_value:
|
|
223
|
-
flag += 1
|
|
224
|
-
# 이전 값이 nan 이 아닌 경우
|
|
225
|
-
else:
|
|
226
|
-
flag = 1
|
|
227
|
-
# idx 시작 위치 지정
|
|
228
|
-
nan_start_idx = idx
|
|
229
|
-
|
|
230
|
-
# 현재 값이 nan 이 아닐 때
|
|
231
|
-
else:
|
|
232
|
-
# 이전 값이 nan 인 경우
|
|
233
|
-
if pre_value == stan_value:
|
|
234
|
-
# idx 끝 위치 지정
|
|
235
|
-
if mode == 'above':
|
|
236
|
-
if flag >= stan_repeat:
|
|
237
|
-
nan_start_idx_list.append(nan_start_idx)
|
|
238
|
-
nan_end_idx_list.append(idx-1)
|
|
239
|
-
elif mode == 'below':
|
|
240
|
-
if flag <= stan_repeat:
|
|
241
|
-
nan_start_idx_list.append(nan_start_idx)
|
|
242
|
-
nan_end_idx_list.append(idx-1)
|
|
243
|
-
else:
|
|
244
|
-
print('mode 를 above 또는 이하 below 중 하나로 지정해주세요')
|
|
245
|
-
raise KeyError()
|
|
246
|
-
pre_value = value_str
|
|
247
|
-
|
|
248
|
-
if value_str == stan_value:
|
|
249
|
-
if mode == 'above':
|
|
250
|
-
if flag >= stan_repeat:
|
|
251
|
-
nan_start_idx_list.append(nan_start_idx)
|
|
252
|
-
nan_end_idx_list.append(idx)
|
|
253
|
-
elif mode == 'below':
|
|
254
|
-
if flag <= stan_repeat:
|
|
255
|
-
nan_start_idx_list.append(nan_start_idx)
|
|
256
|
-
nan_end_idx_list.append(idx)
|
|
257
|
-
else:
|
|
258
|
-
print('mode 를 above 또는 이하 below 중 하나로 지정해주세요')
|
|
259
|
-
raise KeyError()
|
|
260
|
-
|
|
261
|
-
if reverse:
|
|
262
|
-
rev_start_idx_list = [0]
|
|
263
|
-
rev_end_idx_list = [len(ary)-1]
|
|
264
|
-
for ns_idx, ne_idx in zip(nan_start_idx_list, nan_end_idx_list):
|
|
265
|
-
if ns_idx == 0:
|
|
266
|
-
rev_start_idx_list.pop(0)
|
|
267
|
-
rev_start_idx_list.append(ne_idx+1)
|
|
268
|
-
continue
|
|
269
|
-
if ne_idx == len(ary)-1:
|
|
270
|
-
rev_end_idx_list.pop(-1)
|
|
271
|
-
rev_end_idx_list.append(ns_idx-1)
|
|
272
|
-
continue
|
|
273
|
-
rev_start_idx_list.append(ne_idx+1)
|
|
274
|
-
rev_end_idx_list.insert(-1, ns_idx-1)
|
|
275
|
-
return rev_start_idx_list, rev_end_idx_list
|
|
276
|
-
|
|
277
|
-
return nan_start_idx_list, nan_end_idx_list
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|