input sample:
name,price,pay_time,refund_time
job,19.0,20220622 12:23:23,20220622 13:23:23
kim,0,20220623 12:23:23,20220623 13:23:23
expect sample:
name,price,finnal_time
job,19.0,20220622 12:23:23
kim,0,20220623 13:23:23
The rule is once the price is equal to 0 and we will use the refund_time as final_time, otherwise, pay_time will be use.
Currently I do it by using https://github.com/go-gota/gota my code is show as below:
package frame
import (
"fmt"
"github.com/go-gota/gota/dataframe"
"github.com/go-gota/gota/series"
"strings"
)
func LoadCSV() {
csvStr := `
name,price,pay_time,refund_time
job,19.0,20220622 12:23:23,20220622 13:23:23
kim,0,20220623 12:23:23,20220623 13:23:23
`
df := dataframe.ReadCSV(strings.NewReader(csvStr))
df = df.Filter(dataframe.F{Colname: "price", Comparator: series.Eq, Comparando: 0})
fmt.Println("df -->", df)
}
but the output is:
name price pay_time refund_time
0: kim 0.000000 20220623 12:23:23 20220623 13:23:23
<string> <float> <string> <string>
and the other line is deleted, is not what I want.