@@ -153,35 +153,47 @@ def cond_probs(pshift_codes: pd.DataFrame) -> pd.DataFrame:
153153 if key .split ("-" )[0 ] == "A0" :
154154 if key not in ["A0-AY" , "AB-A0" , "AB-AY" , "A0-A0" ]:
155155 cond_prob [key ] = {
156- "CP" : round (freq_table [key ] / frequency_table_and_counts [1 ], 2 )
157- if frequency_table_and_counts [1 ] != 0
158- else 0 ,
159- "CPeTC" : round (freq_table [key ] / frequency_table_and_counts [3 ], 2 )
160- if frequency_table_and_counts [3 ] != 0
161- else 0 ,
156+ "CP" : (
157+ round (freq_table [key ] / frequency_table_and_counts [1 ], 2 )
158+ if frequency_table_and_counts [1 ] != 0
159+ else 0
160+ ),
161+ "CPeTC" : (
162+ round (freq_table [key ] / frequency_table_and_counts [3 ], 2 )
163+ if frequency_table_and_counts [3 ] != 0
164+ else 0
165+ ),
162166 }
163167 else :
164168 cond_prob [key ] = {
165- "CP" : round (freq_table [key ] / frequency_table_and_counts [1 ], 2 )
166- if frequency_table_and_counts [1 ] != 0
167- else 0 ,
169+ "CP" : (
170+ round (freq_table [key ] / frequency_table_and_counts [1 ], 2 )
171+ if frequency_table_and_counts [1 ] != 0
172+ else 0
173+ ),
168174 "CPeTC" : "" ,
169175 }
170176 else :
171177 if key not in ["A0-AY" , "AB-A0" , "AB-AY" , "A0-A0" ]:
172178 cond_prob [key ] = {
173- "CP" : round (freq_table [key ] / frequency_table_and_counts [2 ], 2 )
174- if frequency_table_and_counts [2 ] != 0
175- else 0 ,
176- "CPeTC" : round (freq_table [key ] / frequency_table_and_counts [4 ], 2 )
177- if frequency_table_and_counts [4 ] != 0
178- else 0 ,
179+ "CP" : (
180+ round (freq_table [key ] / frequency_table_and_counts [2 ], 2 )
181+ if frequency_table_and_counts [2 ] != 0
182+ else 0
183+ ),
184+ "CPeTC" : (
185+ round (freq_table [key ] / frequency_table_and_counts [4 ], 2 )
186+ if frequency_table_and_counts [4 ] != 0
187+ else 0
188+ ),
179189 }
180190 else :
181191 cond_prob [key ] = {
182- "CP" : round (freq_table [key ] / frequency_table_and_counts [2 ], 2 )
183- if frequency_table_and_counts [2 ] != 0
184- else 0 ,
192+ "CP" : (
193+ round (freq_table [key ] / frequency_table_and_counts [2 ], 2 )
194+ if frequency_table_and_counts [2 ] != 0
195+ else 0
196+ ),
185197 "CPeTC" : "" ,
186198 }
187199
0 commit comments