Skip to content

Instantly share code, notes, and snippets.

@fabriciosanchez
Created March 10, 2017 13:37
Show Gist options
  • Save fabriciosanchez/b72ce1ce622570618ccfad4093e04498 to your computer and use it in GitHub Desktop.
Save fabriciosanchez/b72ce1ce622570618ccfad4093e04498 to your computer and use it in GitHub Desktop.
Algoritmo Python que formata a saída dos dados.
import pandas as pd
def azureml_main(dataframe1 = None, dataframe2 = None):
columnsnum = len(dataframe1.columns)
columnsnames = dataframe1.columns.values.tolist()
newrows = []
for index, row in dataframe1.iterrows():
entry = ''
for j in range(0, columnsnum):
entry += columnsnames[j] + ':' + str(row[j]) + ' '
entry = entry.replace("Scored Probabilities for Class ", "").replace('"', "")
entry = entry[:-1]
newrows.append(entry)
d = {'Recommendation' : newrows }
dataframe1 = pd.DataFrame(d)
return dataframe1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment