Created
July 20, 2015 15:55
-
-
Save groakat/961f00640dc679679057 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): | |
from scipy.fftpack import fft | |
import numpy as np | |
import pandas as pd | |
from matplotlib.mlab import specgram | |
data1 = np.asarray(dataframe1) | |
spectrum, freqs, t = specgram(data1.squeeze()) | |
# 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 | |
df = pd.DataFrame(np.concatenate((freqs.reshape(-1,1), spectrum), axis=1), | |
columns=['freqs'] + t.tolist()) | |
df.set_index('freqs', inplace=True) | |
# df.rename(columns=[str(x) for x in t], inplace=True) | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment