Helper function to clean and normalize string data. It strips leading and trailing whitespace and replaces multiple whitespace characters with a single space.
(value)
| 113 | |
| 114 | |
| 115 | def clean_string(value): |
| 116 | """Helper function to clean and normalize string data. |
| 117 | |
| 118 | It strips leading and trailing whitespace and replaces multiple whitespace |
| 119 | characters with a single space. |
| 120 | """ |
| 121 | if isinstance(value, str): |
| 122 | return ' '.join(value.split()) |
| 123 | return value |
| 124 | |
| 125 | |
| 126 | class TestingMsDatasets(unittest.TestCase): |