Skip to content

Instantly share code, notes, and snippets.

View dipanjannag's full-sized avatar
🏠
Working from home

Dipanjan dipanjannag

🏠
Working from home
View GitHub Profile
@dipanjannag
dipanjannag / fb_login.py
Created August 17, 2014 02:25
Code to login to Facebook with python script
import urllib
import urllib2
import pdb
import cookielib
from HTMLParser import HTMLParser
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
self.val = "default"
self.name = "default"
@dipanjannag
dipanjannag / counter_test.py
Last active August 29, 2015 14:18
Compair
#!/usr/bin/python
#
# Copyright (c) 2012 Dave Pifke.
# This is a simple performance test of different methods for counting the
# number of occurrences of a series of values.
def values():
"""
Returns a tuple containing four random values: an integer between 0 and
#snippet 1
def azureml_main():
pass
#snippet 2
def azureml_main(dataframe1):
pass
#snippet 3
def azureml_main(dataframe1, dataframe2):
def azureml_main(dataframe1=None, dataframe2 = None):
#do work here
def azureml_main(dataframe1=None, dataframe2=None):
#this code simple do a fit_transform from sklearn #CountVectorizer
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer(min_df=1)
corpus = [“””This is the first document.”””,”””This is the      second document.”””,”””And the third one.”””,”””Is this the first document ?”””,]
X = vectorizer.fit_transform(corpus)
print(X.toarray())
data:text/plain,Caught exception while executing function: Traceback (most recent call last):
File "C:\server\invokepy.py", line 169, in batch
outlist = validateOutput(odfs)
File "C:\server\invokepy.py", line 64, in validateOutput
if (len(returnvalue) == 1 and type(returnvalue[0]) is DataFrame):
def azureml_main(dataframe1=None, dataframe2=None):
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer(min_df=1)
corpus = [“””This is the first document.”””,”””This is the second document.”””,”””And the third one.”””,”””Is this the first document?””,]
X = vectorizer.fit_transform(corpus)
print(X.toarray())
import pandas as pd
ret = pd.DataFrame(X.toarray())
return ret
DllModuleHost Start: 1 : ParameterArgumentBinder::InitializeParameterValues
[ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos count = 43
[ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[0] name = source , type = Microsoft.Analytics.Modules.Reader.Dll.Reader+ReaderDataSourceOrSink
[ModuleOutput] DllModuleHost Verbose: 1 : Converted string 'Http' to enum of type Microsoft.Analytics.Modules.Reader.Dll.Reader+ReaderDataSourceOrSink
[ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[1] name = inputURL , type = System.String
[ModuleOutput] DllModuleHost Verbose: 1 : Passing through string 'http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data'
[ModuleOutput] DllModuleHost Verbose: 1 : parameterInfos[2] name = dataFormat , type = Microsoft.Analytics.Modules.Reader.Dll.HttpReader+DataFormat
[ModuleOutput] DllModuleHost Verbose: 1 : Converted string 'CSV' to enum of type Microsoft.Analytics.Modules.Reader.Dll.HttpReader+DataFormat
[Modu
Record Starts at UTC 03/27/2015 09:19:58:
Run the job:"/dll "Microsoft.Analytics.Modules.Reader.Dll, Version=6.0.0.0, Culture=neutral, PublicKeyToken=69c3241e6f0468ca; Microsoft.Analytics.Modules.Reader.Dll.Reader; Load" /Output0 "..\..\Results dataset\Results dataset.dataset" /source "Http" /inputURL "http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data" /dataFormat "CSV" /csvTsvHasHeader "False" "
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQINBFbAgu8BEAChxwj1gzHuM0Gbo0NYaJ/o/ADB6Z0pZLoLWTzvaDp5IvA0hffF
Z5sJTjzULbxFtYWp2aUJW/AzscAjBY23gH4XU0I6wxKgV92KymxPIte1w72dKyaJ
vpRRAL+vr4k6JM6XzNXg3QWCkhVXjDveOs/I5R30r5D2FxlybS7KFa2BapRx2AMw
/Rnd9TVHKtZ71W7DndUFeGfguGn5GUn4sad5ghCPrefulaznX6ttOs+aQRBGlJ7Y
JPG6rO+BZAvEliCgRgskBJVHJcS9mvpY0ivntOjYuvOVTjlf4I9Ox7x9haqYaQap
NpjpcmUqpSkLxLIeHHT49MGeUdfLzLUIkL1CHC1pDTSxojhikTa/vI4NoPp+ha4I
2a+fUYkBbhhT0+XJrj9xW/FJsNBfKg2RCYJOHFVhXZXcil/GcISddEhIctlZkpyo