0
スパークSQL DataDrame
のカラムは緯度と経度を持ちますが、入力までの距離を計算してしきい値を下回る行をフィルタリングしようとしています。現在のコードは次のようになります。私はgeopy
(great_circle
)を使用して、緯度経度のペア間の距離を計算しています。距離のスパークSQLデータフレームのフィルタリング
from geopy.distance import great_circle
point = (10, 20)
threshold = 10
filtered_df = df.filter(great_circle(point, (df.lat, df.lon)) < threshold)
私はこのコードを実行すると、私は次のエラー
ValueError: Cannot convert column into bool: please use '&' for 'and', '|' for 'or', '~' for 'not' when building DataFrame boolean expressions.
を取得し、私はフィルタ式の一部が間違っているに混乱しています。