0

I had some Pyspark code that was working with a sample csv BLOB and then I decided to point it to a bigger dataset. This line:

df= df.withColumn("TransactionDate", df["TransactionDate"].cast(TimestampType()))

In now throwing this error:

AnalysisException: u'Cannot resolve column name "TransactionDate" among ("TransactionDate","Country ...

Clearly TransactionDate exists as a column in the dataset so why is it suddenly not working?

1 Answer 1

1

Ah ok I figured it out. If you get this issue check your delimiter. In my new dataset it was "," where as in my smaller sample is was "|"

df = spark.read.format(file_type).options(header='true', quote='"', delimiter=",",ignoreLeadingWhiteSpace='true',inferSchema='true').load(file_location)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.