• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Dataframe – splitting dictionary/map column’s keys and assigning values to each of the keys in a row. Pyspark/Pandas

Resolved: Dataframe – splitting dictionary/map column’s keys and assigning values to each of the keys in a row. Pyspark/Pandas

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

Question:

I have a dataframe in pyspark which looks like
I want something like this
Basically, I want the values of my dictionary/Map column to be split and assigned to each of the keys.
Either Pyspark or pandas.
For pandas my df looks like this
MY APPROACH I converted the PYSPARK DF to Pandas Df as I don’t have much experience with Pyspark and new to it, A direct pyspark help will be much appreciated, else even pandas implementation would be great.
The code is not splitting the keys and assigning values.
Edit

Answer:

Using only pyspark:

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

dataframe pandas pyspark python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How can I copy files using the ansible.builtin.copy module and avoid conflicting file names?

26/03/2023

Resolved: Reshape tensors of unknown shape with tf.function

26/03/2023

Resolved: Use Svelte Component as Slot

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

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