我正在玩Angel List(AL)API,想要在圣旧金山开展所有工作.因为我找不到api的活动Python包装器(如果我取得任何进展,我想我想自己制作),我正在使用请求库.
AL API的结果是分页的,我无法弄清楚如何超越结果的第一页.
这是我的代码:
import requests
r_sanfran = requests.get("https://api.angel.co/1/tags/1664/jobs").json()
r_sanfran.keys()
# returns [u'per_page', u'last_page', u'total', u'jobs', u'page']
r_sanfran['last_page']
#returns 16
r_sanfran['page']
# returns 1
Run Code Online (Sandbox Code Playgroud)
我尝试添加参数requests.get,但这不起作用.我也尝试过一些非常愚蠢的东西 - 改变"页面"键的价值,就像那神奇地为我分页.
例如. r_sanfran['page'] = 2
我猜它是相对简单的东西,但我似乎无法弄明白所以任何帮助都会很棒.
一如既往地谢谢.
天使列表API文档,如果它有用.
我有一个关系数据集,我正在寻找二元信息.
我有4列.发件人,接收者,属性,边缘
我想要重复发送者 - 接收者计数并将它们转换为额外的边缘.
df <- data.frame(sender = c(1,1,1,1,3,5), receiver = c(1,2,2,2,4,5),
attribute = c(12,12,12,12,13,13), edge = c(0,1,1,1,1,0))
sender receiver attribute edge
1 1 1 12 0
2 1 2 12 1
3 1 2 12 1
4 1 2 12 1
5 3 4 13 1
Run Code Online (Sandbox Code Playgroud)
我希望最终结果如下所示:
sender receiver attribute edge
1 1 1 12 0
2 1 2 12 3
3 3 4 13 1
Run Code Online (Sandbox Code Playgroud)
重复的发送者 - 接收者之间的关系已被组合,并且重复数量包含在边数中.
任何意见都会非常感激.
谢谢!
我正在尝试按年创建图表类型出现次数的频率图.我已经和ggplot2玩了一段时间,但我认为这是我的头脑(我刚刚开始使用R)
我附上了我想要的结果示意图.我遇到的其他问题之一是图表类型多年没有出现.有没有办法在那一年没有出现图表类型时将其排除?
例如在1940年没有"社会图"我不想在0处有一堆线...
year <- c("1940","1940","1940","1940","1940","1940","1940","1940","1940","1940","1940","1941","1941","1941","1941","1941","1941","1941","1941","1941","1941","1941","1941","1941","1941")
type <- c("Line","Column", "Stacked Column", "Scatter with line", "Scatter with line", "Scatter with line", "Scatter with line", "Map with distribution","Line","Line","Line","Bar","Bar","Stacked bar","Column","Column","Sociogram","Sociogram","Column","Column","Column","Line","Line","Line","Line")
ytmatrix <- cbind(as.Date(as.character(year), "%Y", type))
Run Code Online (Sandbox Code Playgroud)
如果事情没有意义,请告诉我.StackOverflow正在迅速成为我最喜欢的网站之一!
谢谢,乔恩
这是我到目前为止所做的...再次感谢您的帮助!
这就是我做的方式(我还不能共享数据文件,因为我们希望将它用于出版物,但ggplot区域可能更有趣,尽管我没有做任何新的事情/帖子中没有讨论过):
AJS = read.csv(data) #read in file
Type = AJS[,17] #select and name "Type" column from csv
Year = AJS[,13] #select and name "Year" column from csv
Year = substr(Year,9,12) #get rid of junk from year column
Year = as.Date(Year, "%Y") #convert the year character …Run Code Online (Sandbox Code Playgroud) 我正在R中创建一个条形图,并希望按条形高度(计数)为每个条形图着色
目前我所拥有的:
z=rnorm(n,1)
Z=runif(n)
h=barplot(Z)
Run Code Online (Sandbox Code Playgroud)
我有照片,但没有足够的声誉发布它们.所以这是MatLab中的示例: MatLab-Color条形图的高度
我想为Burt的有效尺寸创建一个函数.该公式归结为:
有效尺寸= n - 2t/n
我不确定从哪里开始编写/ for igraph中的函数.
如果有更多细节会有帮助,请告诉我......
谢谢.
r ×4
api ×1
data.table ×1
ggplot2 ×1
graph ×1
graphics ×1
http ×1
igraph ×1
pagination ×1
plot ×1
plyr ×1
python ×1
statistics ×1