Tag : python , By : user161314
Date : March 29 2020, 07:55 AM
|
Parsing txt files and extracting information in R
Date : March 29 2020, 07:55 AM
help you fix your problem The following may help. I assume that you brought your text to character vector(s) Data example ex<-c("The annual observed flow rate: 99.99")
res<-regmatches(ex, regexpr("[0-9]{1,2}.[0-9]{1,2}",ex))
library(cwhmisc)
A<-cpos(ex,"rate", start=1) #position in string
res<-substr(ex, start=A+5, stop=A+9)
ex<-c("The annual observed flow rate: 99.99; the monthly flow rate: 90.03; the weekly observed flow rate: 92.22")
ndat<-unlist(strsplit(ex, "flow"))
|
Merging two csv files and extracting out useful information using python
Tag : python , By : user157064
Date : March 29 2020, 07:55 AM
I wish this help you As you didn't have mentioned weather your id is index name or a column name, so i took as index. import pandas as pd
s1=pd.DataFrame({'id':[10, 11], 'a':[1,2], 'b':[2,3], 'c':[3,4]})
s2=pd.DataFrame({'id':[10, 11, 12], 'd':[2,2, 2], 'e':[3,3, 3]})
merg = pd.merge(left=s1,right=s2,on='id').set_index('id')
print merg
a b c d e
id
10 1 2 3 2 3
11 2 3 4 2 3
|
Date : March 29 2020, 07:55 AM
|
Tag : linux , By : m0gb0y74
Date : November 28 2020, 08:01 AM
|