Coverage for mlprodict/tools/cleaning.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1""" 

2@file 

3@brief Better display. 

4""" 

5 

6 

7def clean_error_msg(df): 

8 """ 

9 Removes EOL from error messages in dataframes. 

10 

11 @param df dataframe 

12 @return df dataframe 

13 """ 

14 def clean_eol(value): 

15 if isinstance(value, str): 

16 return value.replace("\n", " -- ") 

17 return value 

18 

19 df = df.copy() 

20 for c in df.columns: 

21 if "ERROR" in c: 

22 df[c] = df[c].apply(clean_eol) 

23 return df