我正在阅读以下格式的推文:
df.assign(SUM=df.groupby('A').B.transform('sum'))
Out[15]:
A B SUM
0 a 2 13
1 a 5 13
2 a 6 13
3 b 1 3
4 b 2 3
我正在使用的代码是
545253503963516928|Wed Dec 17 16:25:40 +0000 2014|Massachusetts Pharmacy Owners Arrested in Meningitis Deaths http://xxxxxxxxx
545235402156937217|Wed Dec 17 15:13:44 +0000 2014|For First Time, Treatment Helps Patients With Worst Kind of Stroke, Study Says http://xxxxxxxxx
有一条带有撇号的推文:
msn <- read.table(file=".../msnhealthnews.txt",
sep="|",
header = FALSE,
quote="",
fill=TRUE,
stringsAsFactors = FALSE,
numerals ="no.loss",
encoding = "UTF-8")
此推文的内容如下:
You’re Already Losing Your Mind: http://on-msn.com/w0LiSx
如何确保正确阅读推文?我认为设置"You\u0092re Already Losing Your Mind: http://on-msn.com/w0LiSx"
可以解决此问题。