Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.4K
Views
convert columns of pyspark data frame to lowercase

I have a dataframe in pyspark which has columns in uppercase like ID, COMPANY and so on

I want to make these column names to id company and so on. Bacially convert all the columns to lowercase or uppercase depending on the requirement.

I want to do in such away that the data types of the columns remain the same.

How can we do that?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use columns field from DataFrame

df = // load
for col in df.columns:
    df = df.withColumnRenamed(col, col.lower())

Or, as @zero323 suggested:

df.toDF(*[c.lower() for c in df.columns])
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!