Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

Commit

Permalink
Push is no longer supported
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisStevens committed Feb 23, 2016
1 parent 92b84b3 commit 2118659
Showing 1 changed file with 0 additions and 73 deletions.
73 changes: 0 additions & 73 deletions Quandl/Quandl.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,79 +141,6 @@ def get(dataset, **kwargs):

return urldata

def push(data, code, name, authtoken='', desc='', override=False, verbose=False, text=None):
''' Upload a pandas Dataframe to Quandl and returns link to the dataset.
:param data: (required), pandas ts or numpy array
:param str code: (required), Dataset code
must consist of only capital letters, numbers, and underscores
:param str name: (required), Dataset name
:param str authtoken: (required), to upload data
:param str desc: (optional), Description of dataset
:param bool overide: (optional), whether to overide dataset of same code
:param bool verbose: specify whether to print output text to stdout, default is False.
:param str text: Deprecated. Use `verbose` instead.
:returns: :str: link to uploaded dataset'''

override = str(override).lower()
if text is not None:
print('Deprecated: "text" is deprecated and will be removed in next release, use "verbose" instead.')
verbose = text
token = _getauthtoken(authtoken, verbose)
if token == '':
error = ("You need an API token to upload your data to Quandl, "
"please see www.quandl.com/API for more information.")
raise MissingToken(error)

#test that code is acceptable format
_pushcodetest(code)
datestr = ''

# Verify and format the data for upload.
if not isinstance(data, pd.core.frame.DataFrame):
error = "only pandas DataFrames are accepted for upload at this time"
raise ValueError(error)

# check if indexed by date
data_interm = data.to_records()
index = data_interm.dtype.names
datestr += ','.join(index) + '\n'

#format data for uploading
for i in data_interm:
# Check if index is a date
if isinstance(i[0], datetime.datetime):
datestr += i[0].date().isoformat()
else:
try:
datestr += _parse_dates(str(i[0]))
except ValueError:
error = ("Please check your indices, one of them is "
"not a recognizable date")
raise DateNotRecognized(error)
for n in i:
if isinstance(n, (float, int)):
datestr += ',' + str(n)
datestr += '\n'

params = {'name': name,
'code': code,
'description': desc,
'update_or_create': override,
'data': datestr}

url = QUANDL_API_URL + 'datasets.json?auth_token=' + token
jsonreturn = _htmlpush(url, params)
if (jsonreturn['errors']
and jsonreturn['errors']['code'][0] == 'has already been taken'):
error = ("You are trying to overwrite a dataset which already "
"exists on Quandl. If this is what you wish to do please "
"recall the function with overide = True")
raise ValueError(error)

rtn = ('http://www.quandl.com/' + jsonreturn['source_code'] + '/' +
jsonreturn['code'])
#Return URL of uploaded dataset
return rtn


def search(query, source=None, page=1, authtoken=None, verbose=True, prints=None):
Expand Down

1 comment on commit 2118659

@jrovegno
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChrisStevens
Why push is not longer supported?

Please sign in to comment.