Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

StringIndexer pyspark

df_i = spark.createDataFrame([
    ("a", 2.0),
    ("c", 1.0),
    ("b", 2.0),    
    ("a", 1.0),
    ("a", 0.0),   
    ("c", 1.0)
], ["categoryIndex", "categoryIndex2"])
stringID = StringIndexer(inputCol="categoryIndex",outputCol="categoryIndex2")
indexer = stringID.fit(df_i)
df_i = indexer.transform(df_i)
df_i.show()
Comment

PREVIOUS NEXT
Code Example
Python :: python sort dictionary case insensitive 
Python :: fastest sorting algorithm java 
Python :: python print binary tree 
Python :: python for print 
Python :: python iterate through list 
Python :: python bigquery example 
Python :: Python Tkinter ListBox Widget Syntax 
Python :: pathlib change extension 
Python :: comment multiple lines python 
Python :: get pattern from string python 
Python :: python main template 
Python :: python list to sublists 
Python :: how to remove text in pygame 
Python :: pygame screen 
Python :: comment faire pour retourner une liste python 
Python :: self._ in python 
Python :: ValueError: tuple.index(x): x not in tuple 
Python :: import turtle t=turtle.turtle() def star(t): for t in range(5): t.color("red") t.pendown() t.begin_fill() t.forward(100) t.right(144) t.end_fill() 
Python :: how to add percentages to ylabel python 
Python :: how to use self.list.setCurrentRow() in pyqt5 
Python :: emacs pipenv not working 
Python :: make a effective figure in python 
Python :: windows python pip upgrade 
Shell :: restart apache ubuntu 
Shell :: You are running `create-react-app` 5.0.0, which is behind the latest release (5.0.1). We no longer support global installation of Create React App. 
Shell :: installing zoom on ubuntu 20.04 
Shell :: apache check config 
Shell :: install netstat ubuntu 
Shell :: ubuntu check how many cores 
Shell :: reinit gitignore 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =