cancel
Showing results for 
Search instead for 
Did you mean: 

Changing data types in Script Snap: Python

ryan
New Contributor

I got my first script snap to run successfully, but would like to change data types in specific columns. I could do this with a mapper snap I guess but would like to see it in the Script snap if anyone has an example.

2 REPLIES 2

bojanvelevski
Valued Contributor

Hey @ryan,

I’ve never done this, but a regular cast should work for the numbers for example. I did a quick sample in Python that includes changing string to int, and string to datetime, check it out:

image

Pipeline:
DataTypes Change.slp (5.3 KB)

Let me know if this helps

ryan
New Contributor

@bojanvelevski Thank you, I got a script running with changes to datatypes right after I posted that. I was a little confused by the documentation but the standard python methods worked. I will definitely take a look at your example, the more I see the better. Thanks again.