read text file which has been encoded with UCS-2 little Endian using Go

I have a Go program to read a text file similar to the code below: package main import ( “bufio” “log” “os” ) func main() { file, err := os.Open(“test.txt”) if err != nil { log.Fatalf(“failed opening file: %s”, err) } scanner := bufio.NewScanner(file) scanner.Split(bufio.ScanLines) var txtlines []string for scanner.Scan() { txtlines = append(txtlines, scanner.Text())…

Details

Applying group-specific function that returns a single series

I’m trying to figure out an efficient split/apply/combine scheme for the following scenario. Consider the pandas dataframe demoAll defined below: import datetime import pandas as pd demoA = pd.DataFrame({‘date’:[datetime.date(2010,1,1), datetime.date(2010,1,2), datetime.date(2010,1,3)], ‘ticker’:[‘A’, ‘A’, ‘A’], ‘x1’:[10,20,30], ‘close’:[120, 133, 129]}).set_index(‘date’, drop=True) demoB = pd.DataFrame({‘date’:[datetime.date(2010,1,1), datetime.date(2010,1,2), datetime.date(2010,1,3)], ‘ticker’:[‘B’, ‘B’, ‘B’], ‘x1’:[18,11,45], ‘close’:[50, 49, 51]}).set_index(‘date’, drop=True) demoAll = pd.concat([demo1,demo2])…

Details