-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple updates to version update
0.0.8
#54
Associated issue number and/or pull request reference Fixes #50, #51, #52 Proposed solution to the issue Multiple updates were made concurrently as one issue could not be resolved without concurrently working on the other issues. This resulted in more changes than what was originally expected. More information and references Version updated to 0.0.8
- Loading branch information
Showing
8 changed files
with
557 additions
and
501 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.0.7" | ||
__version__ = "0.0.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bib: | ||
- convert_names: True #change name format to Last, First MI | ||
- remove_html: False #TODO: remove html tags | ||
- remove_empty_entries: True #empty entries are removed after `transform` | ||
- truncate_author_list: False #shorten names in the list by only stating the first person followed by optional `suffix` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,45 @@ | ||
import pandas as pd | ||
from pandarize._util import * | ||
from ._util import * | ||
from .loader import Loader | ||
from .parser import Parser | ||
|
||
class Pandarizer: | ||
def __init__(self): | ||
self.raw = None | ||
self.df = None | ||
self.idxkey = None | ||
class Pandarizer(Loader, Parser): | ||
|
||
def initialize(self, yaml=False, path=None): | ||
'''Initializes the setting either for the first time by | ||
loading a default yaml config file in system dir or | ||
load from an user-specified existing the file in `path` | ||
''' | ||
self.load_config(yaml=yaml, path=path) | ||
|
||
def load(self, source=None, savefile=None): | ||
'''Loads raw data from either local file or the url | ||
''' | ||
self.raw = source_loader(source=source, savefile=savefile) | ||
self.raw = bib_preprocessing(raw=self.raw) | ||
self.idxkey = rfindall_matched(self.raw, r'[.*]?@[^}]*{*[,]', '@') | ||
self.source_loader(source=source, savefile=savefile) | ||
self.bib_preprocessing() | ||
|
||
def fit(self, kind='bib'): | ||
def fit(self, kind='bib', postprocess=False): | ||
'''Method that infers data structure (in the future) | ||
''' | ||
if kind == 'bib': | ||
self.df = bib_parser(raw=self.raw, idxkey=self.idxkey) | ||
self.bib_parser(postprocess=postprocess) | ||
|
||
def transform(self, formats='bib', types=None, alias=None, dirs=None): | ||
'''Transform loaded data into a specified data type | ||
''' | ||
if formats == 'bib': | ||
bib_writer(df=self.df, types=types, alias=alias, dirs=dirs) | ||
self.bib_writer(types=types, alias=alias, dirs=dirs) | ||
|
||
def describe(self): | ||
'''Generates basic metadata''' | ||
|
||
if self.df is None: | ||
print('No file is loaded. Please load() and fit() to create metadata.') | ||
return | ||
|
||
if self.df.shape[0] == 0 or self.df.shape[1] == 0: | ||
print('The file has not been loaded successfully. Please check the file path and/or make sure that file is not corrupted.') | ||
return | ||
|
||
print(f'''The loaded file has {self.df.shape[0]} rows and {self.df.shape[1]} columns.\n | ||
''') |
Oops, something went wrong.