Python Tile

Ashleigh
Ashleigh Florida 🟢

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:

"00:00:01.817 domomagic: Version 0.3
00:00:01.819 Traceback (most recent call last):
00:00:01.819   File "<stdin>", line 10, in <module>
00:00:01.819   File "/opt/conda/envs/legacy/lib/python3.7/site-packages/pandas/core/generic.py", line 5067, in __getattr__
00:00:01.819     return object.__getattribute__(self, name)
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)

Best Answers

Answers