Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
M mdf_reader
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • brivas
  • mdf_reader
  • Issues
  • #1

Closed
Open
Created Dec 15, 2020 by brivas@brecinosrivasMaintainer

import_data() has no argument for 'encoding' in TextParser = pd.read_fwf()

The main function in import_data().main has no attribute to pass an specific encoding to the following lines

TextParser = pd.read_fwf(source,widths=[properties.MAX_FULL_REPORT_WIDTH],header = None, delimiter="\t", skiprows = skiprows, chunksize = chunksize, quotechar='\0',escapechar='\0')

This requires to also modify the read.py

by adding

encoding = schema['header'].get('encoding')

to line 265 and modify the TextParser arguments in line 275

TextParser = import_data.main(source, encoding=encoding, chunksize = chunksize, skiprows = skiprows)

This fixed the problem as shown below...

data.data[["c99_header"]].iloc[15]

c99_header  folder_ID                    974
            ship_name             GLÜCK AUF
            rig                       BARQUE
            commander                    NaN
            from_city                HAMBURG
            to_city               VALPARAISO
            voyage_begin_month             5
            voyage_begin_day               7
            voyage_begin_year           1857
            voyage_end_month               6
            voyage_end_day                12
            voyage_end_year             1857
            page_number                  053
Name: 15, dtype: object

Let me know what you think @dyb

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking