LoginSignup
0
0

More than 3 years have passed since last update.

PySparkで文字列をsplitする際にjava.util.regex.PatternSyntaxExceptionが出る

Posted at

起きたこと

下記のようなことをしたところ、

from pyspark.sql import functions as F

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

下記のようなエラーが起きた

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

対処

どうやら?が正規表現の記号と捉えられてしまっているようです。

回避するには?\\?とすれば良いそう。

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

参考

下記のページを参考にしました。ありがとうございます。

エラー『Dangling meta character '?'』の回避方法

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0