Magic ETL

Magic ETL

Python Tile

Tring to split the values in a column into multiple rows using explode and I keep getting an error. I am not too familiar with the python tiles...

The value in my row will be "A<br>B" and I want them to appear as two separate rows, one with A and one with B.

Getting error:

  1. "00:00:01.817 domomagic: Version 0.3
  2. 00:00:01.819 Traceback (most recent call last):
  3. 00:00:01.819 File "<stdin>", line 10, in <module>
  4. 00:00:01.819 File "/opt/conda/envs/legacy/lib/python3.7/site-packages/pandas/core/generic.py", line 5067, in __getattr__
  5. 00:00:01.819 return object.__getattribute__(self, name)
  6. 00:00:01.820 AttributeError: 'DataFrame' object has no attribute 'explode'


My code is:

# Import the domomagic package into the script 

from domomagic import *

import pandas as pd


# read data from inputs into a data frame

input1 = read_dataframe('DataFlows')


# write your script here

df = pd.DataFrame(input1)

df.explode('input_datasources')

output = pd.DataFrame(df)


# write a data frame so it's available to the next action

write_dataframe(output)

**If this answer solved your problem be sure to like it and accept it as a solution!

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In

Best Answers

Answers

Welcome!

It looks like you're new here. Members get access to exclusive content, events, rewards, and more. Sign in or register to get started.
Sign In