通过python查询treasury.io,返回pandas数据帧
treasuryio的Python项目详细描述
PyTreasuryIO
==
访问.._ treasury.io:http://treasury.io,来自python。
_ treasury.io:http://treasury.io,来自“python”。虽然您可以简单地将函数从一个脚本复制粘贴到另一个脚本,但这样可以更快、更容易地启动和运行!
它还有一些助手可以从Treasury.io数据创建一个Twitter机器人。
安装
----
使用PIP安装。:
PIP安装TreasuryIO
示例
--
基本查询
~~~~~~
发送一个SQL查询并接收一个Pandas数据框。:
2013年5月22日
进口国债'
Treaskyio.query(SQL)
~~~~~~~~~~~
write a``~/.twitter.yml``文件。:
consumer密钥:oeshausaooeuhts
consumer密钥:oeshaousaooeuuhu机密:b233tsao-enusaehsunoesuduhoelaouhu9023Uonsheshuahonetuoeuouo0eohneuhoouu
定义一个生成tweet文本的函数,并用
`@govertalio.tweet``decorator装饰它。:
import humanize
helpers to humanize number/dates
def humanize number(num):
return humanize.intword(int(math.ceil(num)).lower()
def humanize date(date):
return humanize.naturalday(date.title()
@govertalyio.tweet
def total_debt_tweet():
df=govertalyio.query('选择日期,从t3c中关闭'u today,其中,'''受限制百分比',年份=2013和月份>;=1)按日期顺序说明')
=abs(当前金额-以前金额)
上一个“amt:
change=“reduced”
人性化值
请注意包含的“human”日期“和“human”数字“函数,它们为您简化了这些值
当前日期=human日期(df[“date”][0])
amt=human数字(当前金额)
delta=human数字(delta)
上一个日期=人类日期(df['date'][end])
此金额自%s-%s起有%s个“%vals
然后运行它。:
total_debt_tweet()
>您可以通过切换使用的函数来获得喜爱。:
import treastoryio
@treastorio.tweet
def tweet_a():
……
@treastorio.tweet
deftweet懔b():
…
@govertalio.tweet
def tweet懔c():
…
random.choice([tweet懔a,tweet懔b,tweet懔c])()
==
访问.._ treasury.io:http://treasury.io,来自python。
_ treasury.io:http://treasury.io,来自“python”。虽然您可以简单地将函数从一个脚本复制粘贴到另一个脚本,但这样可以更快、更容易地启动和运行!
它还有一些助手可以从Treasury.io数据创建一个Twitter机器人。
安装
----
使用PIP安装。:
PIP安装TreasuryIO
示例
--
基本查询
~~~~~~
发送一个SQL查询并接收一个Pandas数据框。:
2013年5月22日
进口国债'
Treaskyio.query(SQL)
write a``~/.twitter.yml``文件。:
consumer密钥:oeshausaooeuhts
consumer密钥:oeshaousaooeuuhu机密:b233tsao-enusaehsunoesuduhoelaouhu9023Uonsheshuahonetuoeuouo0eohneuhoouu
定义一个生成tweet文本的函数,并用
`@govertalio.tweet``decorator装饰它。:
helpers to humanize number/dates
def humanize number(num):
return humanize.intword(int(math.ceil(num)).lower()
def humanize date(date):
return humanize.naturalday(date.title()
@govertalyio.tweet
def total_debt_tweet():
df=govertalyio.query('选择日期,从t3c中关闭'u today,其中,'''受限制百分比',年份=2013和月份>;=1)按日期顺序说明')
=abs(当前金额-以前金额)
上一个“amt:
change=“reduced”
人性化值
请注意包含的“human”日期“和“human”数字“函数,它们为您简化了这些值
当前日期=human日期(df[“date”][0])
amt=human数字(当前金额)
delta=human数字(delta)
上一个日期=人类日期(df['date'][end])
此金额自%s-%s起有%s个“%vals
然后运行它。:
total_debt_tweet()
>您可以通过切换使用的函数来获得喜爱。:
import treastoryio
@treastorio.tweet
def tweet_a():
……
@treastorio.tweet
deftweet懔b():
…
@govertalio.tweet
def tweet懔c():
…
random.choice([tweet懔a,tweet懔b,tweet懔c])()