original_docstring: Uses pandas to read daily CSV file.
      Parses data then imports into sqlite.
      
docstring: Uses pandas to read daily CSV file.
  Parses data then imports into sqlite.
docstring_tokens: Uses pandas to read daily CSV file . Parses data then imports into sqlite .
code: async def import_data(csv_path):
      """Uses pandas to read daily CSV file.
      Parses data then imports into sqlite.
      """
  
      df = pandas.read_csv(csv_path)
      df_list = df.values
      currencies = [
          "USD",
          "JPY",
          "BGN",
          "CZK",
          "DKK",
          "GBP",
          "HUF",
          "PLN",
          "RON",
          "SEK",
          "CHF",
          "ISK",
          "NOK",
          "HRK",
          "RUB",
          "TRY",
          "AUD",
          "BRL",
          "CAD",
          "CNY",
          "HKD",
          "IDR",
          "ILS",
          "INR",
          "KRW",
          "MXN",
          "MYR",
          "NZD",
          "PHP",
          "SGD",
          "THB",
          "ZAR",
      ]
      todays_date = df_list[0][0]
      todays_date = datetime.strptime(todays_date, "%d %B %Y")
      for x in range(len(df_list[0]) - 2):
          print(f"{currencies[x]},{todays_date},{df_list[0][x+1]}")
          currency = Currency(
              currency=currencies[x], date=todays_date, rate=df_list[0][x + 1]
          )
          try:
              session.add(currency)
              session.commit()
          except exc.IntegrityError:
              session.rollback()
              print("Entry exists")
          except exc.PendingRollbackError:
              session.rollback()
              session.flush()
          finally:
              session.close
code_tokens: async def import_data ( csv_path ) : df = pandas . read_csv ( csv_path ) df_list = df . values currencies = [ "USD" , "JPY" , "BGN" , "CZK" , "DKK" , "GBP" , "HUF" , "PLN" , "RON" , "SEK" , "CHF" , "ISK" , "NOK" , "HRK" , "RUB" , "TRY" , "AUD" , "BRL" , "CAD" , "CNY" , "HKD" , "IDR" , "ILS" , "INR" , "KRW" , "MXN" , "MYR" , "NZD" , "PHP" , "SGD" , "THB" , "ZAR" , ] todays_date = df_list [ 0 ] [ 0 ] todays_date = datetime . strptime ( todays_date , "%d %B %Y" ) for x in range ( len ( df_list [ 0 ] ) - 2 ) : print ( f"{currencies[x]},{todays_date},{df_list[0][x+1]}" ) currency = Currency ( currency = currencies [ x ] , date = todays_date , rate = df_list [ 0 ] [ x + 1 ] ) try : session . add ( currency ) session . commit ( ) except exc . IntegrityError : session . rollback ( ) print ( "Entry exists" ) except exc . PendingRollbackError : session . rollback ( ) session . flush ( ) finally : session . close
short_docstring: Uses pandas to read daily CSV file.
short_docstring_tokens: Uses pandas to read daily CSV file .
comment: """Uses pandas to read daily CSV file.
      Parses data then imports into sqlite.
      """