I am trying to parse .edi files with pyspark. I load my files to spark_df with:
spark_df = spark.read.csv(adls_path)
and i get
How to parse _c0 column with PySpark so that every element from both rows is on its own row (it is str and delimiter is ')?

You can use the following python library to parse the EDI files into string format.
https://pypi.org/project/pydifact/
pip install pydifactI am providing a simple code example of parsing EDI files from below location to their string format.
Sample EDI Files used from this location : https://github.com/smooks/unedifact-examples/tree/master/splitting-camel/sample-data
You can convert the above function to a python udf and then call on the above
_c0and get raw string representaiton.An example usage of how to call a simple python function as a udf. https://stackoverflow.com/a/34804340/3238085
Following are java libraries which do the same thing as the above python library.
First :
Second :
Third :
If you decide to use the above jars, here's an example usage of how to call the java functions from the above jars in pyspark
Running custom Java class in PySpark
Output of the top python script :