code: def add_one_stock_daily_data(
      filepath, type, exchange_place, arc, date
  ):
      """
      exchange_place: "SZ" OR "SH"
      type: "tick", "orderbook", ...
      filepath: the path of csv
      arc: arclink created by a process
      """
      code = os.path.split(filepath)[-1].split(".csv")[0]
      if exchange_place == "SH" and code[0] != "6":
          return
      if exchange_place == "SZ" and code[0] != "0" and code[:2] != "30":
          return
  
      df = pd.read_csv(filepath, encoding="gbk", dtype={"code": str})
      code = os.path.split(filepath)[-1].split(".csv")[0]
  
      def format_time(day, hms):
          day = str(day)
          hms = str(hms)
          if hms[0] == "1":  # >=10,
              return (
                  "-".join([day[0:4], day[4:6], day[6:8]])
                  + " "
                  + ":".join(
                      [hms[:2], hms[2:4], hms[4:6] + "." + hms[6:]]
                  )
              )
          else:
              return (
                  "-".join([day[0:4], day[4:6], day[6:8]])
                  + " "
                  + ":".join(
                      [hms[:1], hms[1:3], hms[3:5] + "." + hms[5:]]
                  )
              )
  
      ## Discard the entire row if wrong data timestamp encoutered.
      timestamp = list(zip(list(df["date"]), list(df["time"])))
      error_index_list = []
      for index, t in enumerate(timestamp):
          try:
              pd.Timestamp(format_time(t[0], t[1]))
          except Exception:
              error_index_list.append(
                  index
              )  ## The row number of the error line
  
      # to-do: writting to logs
  
      if len(error_index_list) > 0:
          print("error: {}, {}".format(filepath, len(error_index_list)))
  
      df = df.drop(error_index_list)
      timestamp = list(
          zip(list(df["date"]), list(df["time"]))
      )  ## The cleaned timestamp
      # generate timestamp
      pd_timestamp = pd.DatetimeIndex(
          [
              pd.Timestamp(
                  format_time(timestamp[i][0], timestamp[i][1])
              )
              for i in range(len(df["date"]))
          ]
      )
      df = df.drop(
          columns=["date", "time", "name", "code", "wind_code"]
      )
      # df = pd.DataFrame(data=df.to_dict("list"), index=pd_timestamp)
      df["date"] = pd.to_datetime(pd_timestamp)
      df.set_index("date", inplace=True)
  
      if str.lower(type) == "orderqueue":
          ## extract ab1~ab50
          df["ab"] = [
              ",".join(
                  [
                      str(int(row["ab" + str(i + 1)]))
                      for i in range(0, row["ab_items"])
                  ]
              )
              for timestamp, row in df.iterrows()
          ]
          df = df.drop(columns=["ab" + str(i) for i in range(1, 51)])
  
      type = get_library_name(type)
      # arc.initialize_library(type, lib_type=CHUNK_STORE)
      lib = arc[type]
  
      symbol = "".join([exchange_place, code])
      if symbol in lib.list_symbols():
          print("update {0}, date={1}".format(symbol, date))
          if df.empty == True:
              return error_index_list
          lib.update(symbol, df, chunk_size="D")
      else:
          print("write {0}, date={1}".format(symbol, date))
          lib.write(symbol, df, chunk_size="D")
      return error_index_list
  
imports: from datetime import date, datetime
  import os
  from pathlib import Path
  import random
  import shutil
  import time
  import traceback
  from arctic import Arctic, chunkstore
  import arctic
  from arctic import Arctic, CHUNK_STORE
  from arctic.chunkstore.chunkstore import CHUNK_SIZE
  import fire
  from joblib import Parallel, delayed, parallel
  import numpy
  import pandas
  from pandas import DataFrame
  from pandas.core.indexes.datetimes import date_range
  from pymongo.mongo_client import MongoClient
label_desc: Use image node_id 3 for calling a global function with example usage: add_one_stock_daily_data(filepath, type, exchange_place, arc, date) and returns: error_index_list, unknown, unknown, error_index_list