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