How to encode all apostrophes when exporting CSV file
EL75
New Altair Community Member
Best Answers
-
In order to add an escape character you'll need to use the replace operator. So before you send your data to the export CSV operator add a replace operator and replace ' with \'
Now, it's a really weird problem, as Rapidminer kind of deals with this out of the box already, and I've never had any issues with this. Also writing a file to the desired folder has never been an issue either, just adding the full path (like C:/tmp/dump_me_here.csv) always works for me.
I sometimes have issues with linebreaks, but that's the nature of CSV, nothing to do with rapidminer so I typically export as excel to avoid these issues.
Have you tried to export to excel? This may not be the format you want but at least you could verify it works that way so we can exclude already some scenario's.
If you don't mind sharing your process and (limited part) of your data (export process as rmp and attach, same for any sample test data) we can support better.5 -
Hi Kayman,
You are definitely right
1 - regarding the export, I've solved the problem. The origin of the issue was that I've added - after the "write CSV operator - a "split data" operator to divise my file in 4 parts, but I've connected the 4 outputs outputs directly to a "store" operator, the connected to the result ports... I've forgotten to add again a "write CSV" operator after each "split data". Sorry for wasting your time, thanks for your patience.
2- regarding the character [ ' ], you're solution works well
you're the master !
Wish you the best.
2
Answers
-
encoding typically means adding a backslash in front of it, so like \'
Now, these should not disappear in the first place I think, so you might also try to tweak the settings of your export (like untick 'quote nominal values') as this may interfere with your content also0 -
Hi, Kayman,
could you tell me where I could do this ? I use the "replace" operator, and I tried different ways using \' but that doesn't work.
I also untick the 'quote nominal values' without more success.
By the way, I'm getting mad searching a way of exporting results (CSV file that is the output of the process "write CSV") in a folder on my computer in order to open it with excel. The operator write and store the file in my rapid miner repository...
thanks again for your help, hope you'll save me from there..0 -
In order to add an escape character you'll need to use the replace operator. So before you send your data to the export CSV operator add a replace operator and replace ' with \'
Now, it's a really weird problem, as Rapidminer kind of deals with this out of the box already, and I've never had any issues with this. Also writing a file to the desired folder has never been an issue either, just adding the full path (like C:/tmp/dump_me_here.csv) always works for me.
I sometimes have issues with linebreaks, but that's the nature of CSV, nothing to do with rapidminer so I typically export as excel to avoid these issues.
Have you tried to export to excel? This may not be the format you want but at least you could verify it works that way so we can exclude already some scenario's.
If you don't mind sharing your process and (limited part) of your data (export process as rmp and attach, same for any sample test data) we can support better.5 -
Hi Kayman,
You are definitely right
1 - regarding the export, I've solved the problem. The origin of the issue was that I've added - after the "write CSV operator - a "split data" operator to divise my file in 4 parts, but I've connected the 4 outputs outputs directly to a "store" operator, the connected to the result ports... I've forgotten to add again a "write CSV" operator after each "split data". Sorry for wasting your time, thanks for your patience.
2- regarding the character [ ' ], you're solution works well
you're the master !
Wish you the best.
2