Course_4_Capstone Project Part 1

Hi all, I am facing error when I try to run these 2 last transform jobs.

Job name: de-c4w4a1-songs-transform-job

Error in AWS glue:

AttributeError: ‘DataFrame’ object has no attribute ‘duration’

My script part:

Can any one have what is my mistake?

The problem here is with df.duration.cast, try this:

df = df.withColumn(“duration”, col(“duration”).cast(“double”))

but you need to import

from pyspark.sql.functions import col

if its not actually imported for you!

There might be other ways to cast too.

Hi @gent.spah , thank you for your help . But the problem not solved.

Now my code is this:

But I got this error:

AnalysisException: Column ‘duration’ does not exist. Did you mean one of the following? ;

The failed message is like this:

This is solved, Thank you .

1 Like