通过arma::vec vv0={xx[0], yy[0], zz[0]};
arma::vec vv1={xx[1], yy[1], zz[1]};
arma::vec vv4={xx[4], yy[4], zz[4]};
arma::vec normal1 = normalise(cross(vv1-vv4, vv0-vv4));
,我可以轻松地从字符串列表中创建包含某些字符串模式的频率的数据框。
R
因此,我可以拥有这样的数据框
library(stringr)
library(tm)
library(dplyr)
text = c('i am so hhappy happy now','you look ssad','sad day today','noway')
dat = sapply(c('happy', 'sad'), function(i) str_count(text, i))
dat = data.frame(dat)
dat = dat %>% mutate(Sentiment = (happy)-(sad))
在Python中,我可以假设除 happy sad Sentiment
1 2 0 2
2 0 1 -1
3 0 1 -1
4 0 0 0
sapply()
import pandas as pd
text = ['i am so hhappy happy now','you look ssad','sad day today','noway']
????
dat = pd.DataFrame(dat)
dat['Sentiment'] = dat.apply(lambda c: c.happy - c.sad)
会是什么?
答案 0 :(得分:5)
您可以使用TimeEntries.Hours, TimeEntries.Expenses = 0;
:
pd.Series.str.count