Replace characters in CSV
Forums
I have a csv file that is badly created and doesn't use "" to encapsulate a text field (which I have no control over). Consequently, when there is a comma in one of the fields it creates an issue for that record.
I think I can rely on a standard format for the error as it is a comma followed by a space followed by a text character, e.g. "Exec Director, Programs" (obviously without the quotes). Is there a way to look for that particular sequence of characters and remove the comma, other than manual review in a text editor? It might be achievable with Python script but I don't have Python.
Any suggestions for an automated solution would be gratefully received!
Please have a look on the
Python was installed with IDEA. It comes with an older version 3.5.3 (I don't know whether IDEA 11 comes with a newer version because in our country IDEA V10.4 is the latest version) and supports important modules like numpy, pandas, malplotlib and scikit-learn.
For more information please have a look on the following resources:
https://www.youtube.com/watch?v=wNXWIX6LBq8
https://www.youtube.com/watch?v=oGntZi94Wck
http://ideascripting.com/forum/pythonwin-ide-and-gui-framework
Hi Laura,
Hi Laura,
You could use a text editor that supports regular expression (RegExp). RegExp can be used to look for a particular sequence of characters and remove the comma.
I believe Notepad++ is free and supports RegExp.
Also, depending on the line length of your file, if your max line length in the file is less than 1000 characters you could import file into IDEA and use IDEAs @RegExp function to clean the extra commas. Basically you would import complete line as one field into IDEA and use @RegExp.
If you want, you can upload a sanitized version of your file and someone could show you how to clean it.
Scott
What's your version of IDEA?
What's your version of IDEA? V10.3 and higher has Python support inside.