Try rewriting the filter node in Python pandas to narrow down the columns or change the column name with SPSS Modeler.
Delete the UP_TIME and ERR_CD columns of the following data, Change the column name "M_CD" to "MCD" and the column name "POWER" to "VOLT".
■ Before processing
■ After processing
Check the box you want to delete and write the name you want to change in the field name field on the right.
There are several column choices, but the first is to list the column names you want to keep in the list, as shown below.
df1=df[['M_CD','POWER','TEMP']]
There is also a method called drop that specifies the column you want to delete. This may be closer to the image of the Modeler filter.
df1_1=df.drop(['UP_TIME','ERR_CD'],axis=1)
Both methods return the following results.
Next, you can use a method called rename to change the column name. Gives a set of column names before and after the change in the dictionary.
df2=df1.rename(columns={'M_CD': 'MCD', 'POWER': 'VOLT'})
The following result will be returned.
The sample is placed below.
stream https://github.com/hkwd/200611Modeler2Python/raw/master/filternode/FilterNode.str notebook https://github.com/hkwd/200611Modeler2Python/blob/master/filternode/FilterNode2.ipynb
■ Test environment Modeler 18.2.1 Windows 10 64bit Python 3.6.9 pandas 0.24.1
Select and get rows / columns by pandas index reference | note.nkmk.me https://note.nkmk.me/python-pandas-index-row-column/ Change row name / column name of pandas.DataFrame | note.nkmk.me https://note.nkmk.me/python-pandas-dataframe-rename/
Recommended Posts