For example, I want to write a program to import data from a DBF file into a database. I compiled the algorithm. First I convert a DBF file to a CSV file, then a CSV file into the Pandas Dataframe. Then I import the data from Pandas Dataframe into the database. Thus, each step of the algorithm is a separate subroutine that can work independently of the other steps.
import csv
import dbf
import pandas as pd
class Dbf3ToCsv(object):
"""Process a DBF III w/o memo file to a CSV file"""
def __init__(self):
pass
class CsvToDataframe(object):
"""Process a CSV file to Pandas Dataframe"""
def __init__(self):
pass
class DataframeToDatabase(object):
"""Process a Pandas Dataframe to a Database"""
def __init__(self):
pass
But I have a separate class for the basis in which all 3 subroutines are assembled into one common program.
class ImportDbfToDatabase(object):
"""Import a DBF data to a database"""
def __init__(self):
pass
Am I writing the code correctly? Or it is necessary to write a class of the basic program somehow in another way?