• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Create columns with upper and lower borders obtained from list

Resolved: Create columns with upper and lower borders obtained from list

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have a DataFrame and a list of borders:
And I want to add two new columns to the DataFrame (“LowerBorder”, “UpperBorder”) for the “Population” column.
And when I tried it to do with just python list and functions, it worked:
Expected output for test DataFrame is:

Answer:

You can create an array out of your border_list, then filter it and select either minimum or maximum.

If you have better answer, please add a comment about this, thank you!

apache-spark apache-spark-sql list pyspark python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: how to get and read an xml file in a zip file using xml.etree

02/04/2023

Resolved: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. cors error not resolving

02/04/2023

Resolved: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘crm.email’ doesn’t exist (Connection: mysql, SQL: select count(*) as aggregate from `email`

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.