Forum Discussion
Anonymous
3 years agoNot applicable
Pandas dataframe passed to Python script is corrupted
Hi, I have a table that I download from a Salesforce report. One of the columns is the Saleforce case number and another one ('Defect')is a free text which may contain the string 'ABC-number', where...
- Anonymous3 years ago
The response from Microsoft is that Power BI was not designed to handle embedded newlines - see here:
So the only solution is to "sanitize" the data before invoking Python or R.
To do that, use the Table.ReplaceValue() in M Query, see below. All these actions can be invoked from the GUI.
#"Duplicated Column" = Table.DuplicateColumn(#"some-previous-step", "Defect", "Defect - Copy")
// Santize the new column
#"Replaced Value" = Table.ReplaceValue(#"Duplicated Column","#(lf)","___",Replacer.ReplaceText,{"Defect-Copy"}),#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","#(cr)","___",Replacer.ReplaceText,{"Defect-Copy"}),
// Must remove the original bad column
#"Removed Columns1" = Table.RemoveColumns(#"Replaced Value1",{"Defect"}),
// Rename the new column
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns1",{{"Defect-Copy", "DefectSanitized"}})
Anonymous
3 years agoNot applicable
I have submitted an issue, here