Skip to content

Commit

Permalink
#407. pandas-based operations were removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Oct 18, 2022
1 parent b84b0a6 commit f90d78c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions arekit/contrib/utils/data/writers/json_opennre.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

from arekit.common.data import const
from arekit.contrib.utils.data.storages.pandas_based import PandasBasedRowsStorage
from arekit.common.data.storages.base import BaseRowsStorage
from arekit.contrib.utils.data.writers.base import BaseWriter

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -36,18 +36,10 @@ def __write_bag(bag, json_file):
json_file.write("\n")

def save(self, storage, target):
assert(isinstance(storage, PandasBasedRowsStorage))
assert(isinstance(storage, BaseRowsStorage))
assert(isinstance(target, str))

######################################################
# TODO. #407 Just delete the related depencies below.
# TODO. #407 finally switch to BaseRowsStorage.
######################################################
df = storage.DataFrame
df.sort_values(by=[const.ID], ascending=True)
######################################################
logger.info("Saving... {shape}: {filepath}".format(shape=df.shape, # self._df.shape,
filepath=target))
logger.info("Saving... {rows}: {filepath}".format(rows=(len(storage)), filepath=target))

os.makedirs(os.path.dirname(target), exist_ok=True)
with open(target, "w", encoding=self.__encoding) as json_file:
Expand Down

0 comments on commit f90d78c

Please sign in to comment.