Skip to content

Instantly share code, notes, and snippets.

@KentaroAOKI
Last active August 29, 2015 14:22
Show Gist options
  • Save KentaroAOKI/0e392a90ab7198db5f5b to your computer and use it in GitHub Desktop.
Save KentaroAOKI/0e392a90ab7198db5f5b to your computer and use it in GitHub Desktop.
# The script MUST contain a function named azureml_main
# which is the entry point for this module.
#
# The entry point function can contain up to two input arguments:
# Param<dataframe1>: a pandas.DataFrame
# Param<dataframe2>: a pandas.DataFrame
def azureml_main(dataframe1 = None, dataframe2 = None):
# Execution logic goes here
print('Input pandas.DataFrame #1:\r\n\r\n{0}'.format(dataframe1))
# If a zip file is connected to the third input port is connected,
# it is unzipped under ".\Script Bundle". This directory is added
# to sys.path. Therefore, if your zip file contains a Python file
# mymodule.py you can import it using:
# import mymodule
# Return value must be of a sequence of pandas.DataFrame
return dataframe1,
#--- You can copy the above code to the Execute Python Script of Azure ML.
import sys
import codecs
import numpy as np
from pandas import Series, DataFrame
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
df1 = pd.read_csv('C:\Users\xxx\Documents\df1.csv')
df2 = pd.read_csv('C:\Users\xxx\Documents\df2.csv')
dfr = azureml_main(df1, df2)
print dfr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment