Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 17419

Put comments in between multi-line statement (with line continuation) [duplicate]

$
0
0

When i write a following pyspark command:

# comment 1df = df.withColumn('explosion', explode(col('col1'))).filter(col('explosion')['sub_col1'] == 'some_string') \    # comment 2    .withColumn('sub_col2', from_unixtime(col('explosion')['sub_col2'])) \    # comment 3    .withColumn('sub_col3', from_unixtime(col('explosion')['sub_col3']))

I get the following error:

.withColumn('sub_col2', from_unixtime(col('explosion')['sub_col2']))^IndentationError: unexpected indent

Is there a way to write comments in between the lines of multiple-line commands in pyspark?


Viewing all articles
Browse latest Browse all 17419

Latest Images

Trending Articles



Latest Images