我的数据就是这样-
with open('README.md', 'r', encoding='utf-8') as fh:
TypeError: 'encoding' is an invalid keyword argument for this function
C:\Temp\DSNImport>cd "C:\Temp\DSNImport\picu\python libraries"
C:\Temp\DSNImport\picu\python libraries>pip install openpyxl-2.6.2.tar.gz PyAutoGUI-0.9.44.tar.gz et_xmlfile-1.0.1.tar.gz jdcal-1.4.1-py2.py3-none-any.whl Pillow-6.0.0.tar.gz PyGetWindow-0.0.5.tar.gz PyRect-0.1.4.tar.gz PyScreeze-0.1.21.tar.gz
Processing c:\temp\dsnimport\picu\python libraries\openpyxl-2.6.2.tar.gz
Processing c:\temp\dsnimport\picu\python libraries\pyautogui-0.9.44.tar.gz
Processing c:\temp\dsnimport\picu\python libraries\et_xmlfile-1.0.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): et-xmlfile==1.0.1 from file:///C:/Temp/DSNImport/picu/python%20libraries/et_xmlfile-1.0.1.tar.gz in c:\programdata\anaconda2\lib\site-packages
Processing c:\temp\dsnimport\picu\python libraries\pillow-6.0.0.tar.gz
Processing c:\temp\dsnimport\picu\python libraries\pygetwindow-0.0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\superu~1\appdata\local\temp\pip-bbamct-build\setup.py", line 10, in <module>
with open('README.md', 'r', encoding='utf-8') as fh:
TypeError: 'encoding' is an invalid keyword argument for this function
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in c:\users\superu~1\appdata\local\temp\pip-bbamct-build\
C:\Temp\DSNImport\picu\python libraries>
我要这样排列-
p1 x1
p2 x2
p1 x3
p7 x4
p5 x5
p2 x6
p5 x7
p7 x8
p1 x9
p2 x10
我该如何使用R /命令行或Excel?
答案 0 :(得分:1)
我们可以使用aggregate
aggregate(col2 ~ col1, df1, toString)
如果元素重复,则获取unique
行并进行aggregate
aggregate(col2 ~ col1, unique(df1), toString)
答案 1 :(得分:1)
您可以使用dpylr按组group_by
paste
,然后按组library(dplyr)
group_by(df, c1) %>% summarise(c2 = paste(c2, collapse = ","))
#### OUTPUT ####
# A tibble: 4 x 2
c1 c2
<fct> <chr>
1 p1 x1,x3,x9
2 p2 x2,x6,x10
3 p5 x5,x7
4 p7 x4,x8
第二列:
const that = this;
const valueline = d3.line()
.x(function (d, i) {
return that.x(d.date) + 0.5 * that.x.bandwidth();
})
.y(function (d) {
return that.y(d.value);
});
this.x.domain(data.map((d: any) => d.date));
this.y.domain(d3.extent(data, function (d) {
return d.value
}));
const thisLine = this.chart.append("path")
.data([data])
.attr("class", "line")
.attr("d", valueline);
const totalLength = thisLine.node().getTotalLength();
thisLine.attr("stroke-dasharray", totalLength + " " + totalLength)
.attr("stroke-dashoffset", totalLength);
thisLine.transition()
.duration(1500)
.attr("stroke-dashoffset", 0)
let circle = this.chart.selectAll("line-circle")
.data(data);
circle = circle
.enter()
.append("circle")
.attr("class", "line-circle")
.attr("r", 4)
.attr("cx", function (d) {
return that.x(d.date) + 0.5 * that.x.bandwidth();
})
.attr("cy", function (d) {
return that.y(d.value);
})
circle
.attr("r", 4)
.attr("cx", function (d) {
return that.x(d.date) + 0.5 * that.x.bandwidth();
})
.attr("cy", function (d) {
return that.y(d.value);
})
circle
.exit()
.remove()