How to split all words in a row, separated by a comma, and append them. The result should be only on
How to split all words in a row, separated by a comma, and append them. The result should be only one column with only one word per row?
Answers
-
I think there's a split column tile in Magic ETL. You could try creating an ETL, split column using comma as the delimiter. Then use an unpivot columns tile which would turn them into rows under one column.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
My main question is, after I split this column by comma and create 13 new columns with only a single word/product in a cell, how can I stack them together to get one column with one word/product per a row?
0 -
Here's an example. Using the following sample data
id,word_list
1,"apple,banana,cherry"
2,"grape,orange"
3,"mango,peach,plum,kiwi"
4,"strawberry"I uploaded this as "Sample csv content".
Then I build an ETL.
In the split column tile:
In the unpivot tile:
My final dataset:
If I had only one row, I would end with only one column. This example assumes you want to work with many rows since you mention something about appending. I assume you are asking about appending the continuation of words as more rows.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
I'd recommend using a python tile, so that you don't have to assume or maintain a specific number of splits
# Import the domomagic package into the script from domomagic import * # read data from inputs into a data frame df = read_dataframe('<INPUT TILE NAME>') #change <INPUT TILE NAME> # write your script here # Split the CSV string into lists df['csv_split'] = df['<CSV COLUMN NAME>'].str.split(',') #change <CSV COLUMN NAME> # Explode the lists into separate rows df_exploded = df.explode('csv_split').reset_index(drop=True) # write a data frame so it's available to the next action write_dataframe(df_exploded)
1
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 308 Workbench
- 6 Cloud Amplifier
- 10 Federated
- 3.8K Transform
- 660 Datasets
- 117 SQL DataFlows
- 2.2K Magic ETL
- 815 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 84 App Studio
- 46 Variables
- 781 Automate
- 191 Apps
- 483 APIs & Domo Developer
- 84 Workflows
- 23 Code Engine
- 42 AI and Machine Learning
- 22 AI Chat
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 408 Distribute
- 116 Domo Everywhere
- 281 Scheduled Reports
- 11 Software Integrations
- 146 Manage
- 142 Governance & Security
- 8 Domo Community Gallery
- 49 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive