I want to call some functions but I don't know how to import the package. I tried like follows but it failed. How can I do? (I want to use some third-party package to analyzing each doc, the code below is just a test)
Please, if you know the answer...
import couchdb as db
import datetime
couch = db.Server()
d1 = couch['test']
def map(doc):
text = doc['text']
ti = doc['timestamp_ms']
ti = ti[:10] + '.' + ti[10:]
dateArray = datetime.datetime.utcfromtimestamp(float(time))
if (dateArray.time().hour < 12):
yield ["am"], text
else:
yield ["pm"], text
for row in d1.query(map, descending=True, language='python'):
print row.key, row.value