daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 134 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. url = 'http://loco-proxy.itclover.ru:8123'
  2. user = 'loco_user'
  3. password = 'A7qoFxdH8PadW5B'
  4.  
  5. loco_num_val = '0335'
  6. section_val = 'B'
  7. datetime_start_val = '2018-05-06 10:00:02'
  8. datetime_end_val = '2018-05-06 14:59:59'
  9.  
  10. model = Model()
  11. query = f"""
  12.                SELECT DISTINCT
  13.                    date_time as dt,
  14.                    loco_id as loco_id,
  15.                    PositionFuelRods as PositionFuelRods,
  16.                    SpeedEngine as SpeedEngine,
  17.                    PosKM as PosKM,
  18.                    PAirTurbocharger as PAirTurbocharger,
  19.                    SpeedTurbocharger as SpeedTurbocharger,
  20.                    Pboost as Pboost,
  21.                    PowerPolling as PowerPolling
  22.            
  23.                FROM default.TE116U_062  
  24.                WHERE loco_num='0335' AND
  25.                      section='{section_val}' AND
  26.                      dt BETWEEN '{datetime_start_val}' AND '{datetime_end_val}'
  27.  
  28.            
  29.                order by dt
  30.                """
  31.  
  32. df = read_clickhouse(query, connection={'host': url,
  33.                                         'database': 'default',
  34.                                         'user': user,
  35.                                         'password': password})
  36.  
  37. new_df = model.predict(df)
  38. new_df.to_csv('test.csv')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top