NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

main_flare.py

# author : makcin

# Importing Libraries
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor
import copy
from sklearn.metrics import mean_absolute_error
import openpyxl
from datetime import date, timedelta
from sklearn.linear_model import HuberRegressor, LinearRegression, TheilSenRegressor, RANSACRegressor
from sklearn.linear_model import Ridge, Lasso
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.linear_model import ElasticNetCV
from sklearn.linear_model import ElasticNet
from sklearn.utils.validation import check_consistent_length, check_array
pd.set_option('display.max_rows', 6000)
from scripts import _check_reg_targets,mean_absolute_percentage_error,best_model_pipeline,taking_average
import warnings
warnings.filterwarnings("ignore")
import re
from openpyxl import load_workbook
from datetime import datetime

# ------- WASTE Models --------------------
# 1- WASTE FG Prediction Model (Average)

df_org = pd.read_excel("FLARE_Tags_17082022.xlsx",index_col = 0,engine='openpyxl')

df_org.rename(columns = {'0101.FQR2002':'ETHYLENE_Fuelgas_Export',
'7501.FQI9100':'WASTE_Fuelgas_Import',
'0401.FI449.PV':'VCM_Fuelgas_Import',
'1701.FI226':'PP_Fuelgas_Import',
'2101.FQT029.DACA.PV':'ACN_Fuelgas_Import',
'4001.FT9000.DACA.PV':'PA_Fuelgas_Import'}, inplace = True)

df_flare = copy.deepcopy(df_org)

# Confidence 0 olan dataları veri setinden düşürmek.
df_flare_manipulated = copy.deepcopy(df_flare)

confidence_cols = list([col for col in df_flare_manipulated.columns if 'Confidence' in col])

for i in confidence_cols:
df_flare_manipulated.drop(
df_flare_manipulated.loc[(df_flare_manipulated[i] == 0)].index,
inplace=True)

df_flare_manipulated.drop(confidence_cols,axis=1,inplace=True)


# Sıfırdan küçük değerlerin sıfıra eşitlenmesi

main_features = list(df_flare_manipulated.columns)

for i in main_features:
df_flare_manipulated.loc[df_flare_manipulated[i] < 0, i] = 0

# Average alma ve excel'e yazma

# VCM Fuelgas Import (Average)

wb = load_workbook('Draft_Final_Output.xlsx')

fg_import_sheet = wb['FG_Import_Other_Units']

vcm_fuelgas = taking_average(df_flare_manipulated,'VCM_Fuelgas_Import')

fg_import_sheet['K3'] = round(vcm_fuelgas,2)

# PP Fuelgas Import (Average)

pp_fuelgas = taking_average(df_flare_manipulated,'PP_Fuelgas_Import')

fg_import_sheet['K4'] = round(pp_fuelgas,2)

# PA Fuelgas Import (Average)

pa_fuelgas = taking_average(df_flare_manipulated,'PA_Fuelgas_Import')

fg_import_sheet['K5'] = round(pa_fuelgas,2)


# Flare Fuelgas Import (Average)

# Ethylene FG Export ve ACN Fuelgas Import tahminleri yapıldıktan sonra, Flare Fuelgas Import değeri de hesaplanabilecektir.


fg_import_sheet['R1'] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

wb.save(r'C:Usersmert.akcinDesktopDaily NG DemandNG_Demand_NewNg_Demand_Prod_CodeDraft_Final_Output.xlsx')
wb.close()

     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.