PySpark Practice Question | Return companies with high profits

 


data = [(1, 'Alpha Corp'),
(2, 'Beta LLC'),
(3, 'Gamma Inc'),
(4, 'Delta Ltd'),
(5, 'Epsilon Plc'),
(6, 'Zeta GmbH'),
(7, 'Eta SA'),
(8, 'Theta Srl'),
(9, 'Iota Partners'),
(10, 'Kappa Co')]
schema = ['id','name']
company_df = spark.createDataFrame(data,schema)


data1 =[(1, 5000, 8000),
(2, 3000, 4500),
(3, 7000, 15000),
(4, 2000, 3000),
(5, 8000, 12000),
(6, 2500, 4000),
(7, 4500, 6500),
(8, 1000, 1500),
(9, 6000, 9000),
(10, 5500, 8500)]
schema1 =['company_id','expenses','revenue']
sales_df = spark.createDataFrame(data1,schema1)

Comments

Popular posts from this blog

PySpark Interview Question | Retrieve orders who sold multiple products

PySpark Practice Question | Map Adult and Child based on Age