-
Notifications
You must be signed in to change notification settings - Fork 0
Parser.py
The Parser module contains one class, Table(), initialized with the filepath of the JSON and contains two instance variables:
Table.filepath = The filepath of the JSON file
Table.parsedTable = The resulting parsed table
Table() contains multiple methods to achieve the above:
Table.openJsonFile(self): Opens and reads the JSON file at Table.filepath.
Table.parseJson(self): Parses a JSON file to a pandas DataFrame
Table.createDataFrame(self): Creates a Pandas DataFrame from a dictionary
Table.parseDataColumn(self): Iterates over dictionaries in a Pandas DataFrame
Table.concatAndTransposeData(self): Formats all dictionaries present in columns to a pandas DataFrame
Table.parseNameSpace(self, regex, testString): takes a regex string and searches for matches.
Table.namespaceBruteSearch(self): Extracts all available column headers in the namespace column.
Table.getAllFrames(self): Creates a human readable DataFrame
Table.addFromBruteSearch(self): adds column headers from namespaces to each record
Table.renameCol(self): Creates an appropriate name for each column
from Parser import Table
fpath = ~/documents/V2/someJsonFile.json
table = Table(fpath)
table.parsedTable()