Domo Python error
i am using the python tile in domo magic etl
i am trying to cast a column to a category
but when i try and read the dataframe to the write_dataframe i get an error
# Import the domomagic package into the script
from domomagic import *
# read data from inputs into a data frame
raw = read_dataframe('Source 2')
#print('Before Cast')
#print(raw.dtypes)
#cast to correct dtypes to save space
raw = raw.astype({'VEEVA Entity ID': 'category'}, errors='raise')
print(type(raw))
write_dataframe(raw)
The error i get is has anyone else had a similar issue. it seems like domo specific outside of domo in pure python the code works.
Traceback (most recent call last): 00:00:10.604 File "<stdin>", line 25, in <module> 00:00:10.606 File "/home/domo/domomagic/io.py", line 46, in write_dataframe 00:00:10.606 write_array_dict(d) 00:00:10.606 File "/home/domo/domomagic/io.py", line 59, in write_array_dict 00:00:10.606 raise ValueError('domomagic: Array dict values must be numpy.ndarrays') 00:00:10.606 ValueError: domomagic: Array dict values must be numpy.ndarrays
Comments
-
Try converting the series itself as a category:
raw['VEEVA Entity ID'] = raw['VEEVA Entity ID'].astype('category', errors='raise')
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
raw['VEEVA Entity ID'] = raw['VEEVA Entity ID'].astype('category', errors='raise')
does not work but
raw['VEEVA Entity ID'] = raw['VEEVA Entity ID'].astype(str, errors='raise')
does work
leads me to believe
some sort of problem between numpy datatype and a dataframe datatype
this happens on the write_dataframe(raw) some sort of bug from the looks of it .
it doesn't matter we will recreate the dataflow in adrenaline
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive