code: import numpy as np
  import pandas as pd
  import psycopg2, sys
  
  hostname, user, dbname, passward = sys.argv[1:5]
  
  
  def load_data():
      lon0, lat0 = 115.8, 29.4
      x = pd.read_excel('../data/x.xlsx', header=0, index_col=0).values
      y = pd.read_excel('../data/y.xlsx', header=0, index_col=0).values
      
      lon = lon0 + 360*x/np.pi/6371
      lat = lat0 + 180*y/np.pi/6371
      lon_list, lat_list = [], []
  
      for i in range(lon.shape[0]):
          lon_list.append([x for x in lon[i,:] if not np.isnan(x)])
          lat_list.append([x for x in lat[i,:] if not np.isnan(x)])
  
      return lon_list, lat_list
  
      
  if __name__ == '__main__':
      conn = psycopg2.connect(host=hostname, port=5432, user=user, 
                              dbname=dbname, password=passward)
      cursor = conn.cursor()
      
      lon_list, lat_list = load_data()
      flag, sep_list = 1, [0]
      for i in range(len(lon_list)):
          for j in range(len(lon_list[i])):
              cursor.execute("insert into my_point (point_id,lon,lat) values (%s,%s,%s)",
                             (flag, lon_list[i][j], lat_list[i][j]))
              flag += 1
          sep_list.append(flag-1)
          print(i+1, '/', len(lon_list), 'num:', len(lon_list[i]))
          # if i == 10:
              # break
      for i in range(len(sep_list)-1):
          cursor.execute("insert into my_line (line_id,point_list) values (%s,%s)",
                         (i+1, list(range(sep_list[i]+1,sep_list[i+1]+1))))
  
      # conn.commit()
      conn.close()
  
  
apis: pandas.read_excel numpy.isnan