I have list containing columns the user has selected.
These are already numeric, but I want to find those that are with time or date format as they need special treatment.
How can I filter these using JSL?
Here is an example of one way to do this. The script opens a data table, finds all of the numeric, continuous column names, and then deletes the ones where it finds that it has a format that is one of the listed Date and DateTime formats.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Aircraft Incidents.jmp" );
colList = dt << get column names( string, numeric, continuous );
// Create a list of the date and datetime formats to check for
dateList = {"m/d/y", "mmddyyyy", "m/d/y h:m", "m/d/y h:m"};
show("All Numeric List", colList );
For( i = N Items( colList ), i >= 1, i--,
If(
Contains(
dateList,
Word( 2, Char( Column( dt, colList[i] ) << get format ), "(,\!"" )
),
show(Word( 2, Char( Column( dt, colList ) << get format ), "(,\!"" ));
Remove From( colList, i, 1 )
)
);
show("\!nList with Date columns removed", colList );Indeed, without context it does not make much sense.
PythonSend() works by saving a temporary csv and loading it into pandas. When dealing with dates, current JMP implementation does not have the date_parser active and the object is load as text instead of a number.
Python Send() does not recognize datetime format (sent as string)
As my date column is within other X's which are continuous, I need a way to either filter that column out or transform it to integers.