Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions exports/parquet.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ExportToParquet(ctx context.Context, w io.Writer, df *dataframe.DataFrame,
// Create Schema
dataSchema := dynamicstruct.NewStruct()
for _, aSeries := range df.Series {
fieldName := strings.Title(strings.ToLower(aSeries.Name()))
fieldName := "Z" + strings.Title(strings.ToLower(aSeries.Name())) // Make it validly exported
seriesName := santizeColumnName(aSeries.Name())

switch aSeries.(type) {
Expand Down Expand Up @@ -125,7 +125,7 @@ func ExportToParquet(ctx context.Context, w io.Writer, df *dataframe.DataFrame,

rec := schemaStruct.New()
for _, aSeries := range df.Series {
fieldName := strings.Title(strings.ToLower(aSeries.Name()))
fieldName := "Z" + strings.Title(strings.ToLower(aSeries.Name()))

v := reflect.ValueOf(rec).Elem().FieldByName(fieldName)
if v.IsValid() {
Expand Down
16 changes: 16 additions & 0 deletions imports/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ func LoadFromCSV(ctx context.Context, r io.ReadSeeker, options ...CSVLoadOptions

var init *dataframe.SeriesInit

// Check for bom characters in the beginning (that python seems to add).
// See:
// https://github.com/rocketlaunchr/dataframe-go/issues/62
// https://github.com/golang/go/issues/33887
// https://github.com/dimchansky/utfbom
// https://github.com/spkg/bom/
checkBOM := make([]byte, 3)
readN, err := r.Read(checkBOM)
if err != nil {
return nil, err
}
if !(readN == 3 && checkBOM[0] == 0xef && checkBOM[1] == 0xbb && checkBOM[2] == 0xbf) {
// bom not found so reset reader
r.Seek(0, io.SeekStart)
}

var (
comma rune
comment rune
Expand Down