[PYTHON] I get a java.util.regex.PatternSyntaxException when splitting a string in PySpark

What happened

When I did the following

from pyspark.sql import functions as F

split_col = F.split(df["hoge"], "?")

I got the following error

java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0

Coping

Apparently, ? Is regarded as a regular expression symbol.

To avoid it, replace ? With \\?.

split_col = F.split(df["hoge"], "\\?")

reference

I referred to the following page. Thank you very much.

Workaround for error'Dangling meta character'?'

Recommended Posts

I get a java.util.regex.PatternSyntaxException when splitting a string in PySpark
I get a UnicodeDecodeError in mecab-python3
I get a KeyError in pyclustering.xmeans
I get a can't set attribute when using @property in python
I get a UnicodeDecodeError when running with mod_wsgi
In the Chainer tutorial, I get an error when importing a package. (mock)
I get a strange window when I use the open directory dialog in Tkinter
I want to embed a variable in a Python string
I get an error when I put opencv in pyautoGUI
I tried "How to get a method decorated in Python"
I wrote a script to get a popular site in Japan
Processing order when chaining when in PySpark
A memorandum when I tried to get it automatically with selenium
When I get an error with Pylint in Atom on Windows
How to get a string from a command line argument in python
Timezone specification when converting a string to datetime type in python
When creating a matrix in a list
Create a random string in Python
Get the formula in an excel file as a string in Python
When writing a program in Python
Get the query string (query string) in Django
Get a Boolean in Flask's request
I get an error when I put a Python plugin in Visual Studio Code under the pyenv environment
Where do I stop when I set a breakpoint in a function in GDB (x86)
I made a Discord bot in Python that translates when it reacts
When you get a cannot assign module before Module.init () call in pytorch
I get a UnicodeDecodeError when trying to connect to oracle with python sqlalchemy
I want to color a part of an Excel string in Python
How to write a string when there are multiple lines in python
I get a firewall warning when I start gqlgen's server.go on my Mac
I want to print in a comprehension
I made a payroll program in Python!
Precautions when pickling a function in python
Use a scikit-learn model trained in PySpark
When I get an error with PyInstaller
How to get a stacktrace in python
Get a Unicode JSON string containing Japanese.
I can't get the element in Selenium!
Get a token for conoha in python
Generate a class from a string in Python
I started Node.js in a virtual environment
I created a password tool in Python.
What I was addicted to when creating a web application in a windows environment
When I name the file flask.py in Flask, I get Import Error: cannot import name'Flask'
I was in vain because I couldn't get a send parent order with pybitflyer
[Python] What to check when you get a Unicode Decode Error in Django
[Python] I tried to get the type name as a string from the type function
Get the last element of the array by splitting the string in Python and PHP
[Python] Get the files in a folder with Python
A memo that I wrote a quicksort in Python
How to embed a variable in a python string
Get the caller of a function in Python
I want to create a window in Python
I tried playing a typing game in Python
When I try matplotlib in Python, it says'cairo.Context'
I wrote a class in Python3 and Java
[Memo] I tried a pivot table in Python
Get only the subclass elements in a list
Get a panoramic image in Google Street View
I wrote a design pattern in kotlin Prototype
Python Note: When assigning a value to a string