What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-07 22:50:11
read pickle file
with open('filename', 'rb') as f: x = pickle.load(f) Add solution -
Python 2021-10-12 12:21:03
sklearn save model
# fit the model model.fit(X_train, y_train) # save the model import pickle pickle.dump(model, open("model.pkl", "wb")) # load the model model = pickle.load(open("model.pkl", "rb")) # use model to predict y_pred =... Add solution -
Python 2021-10-11 11:44:11
save and load sklearn model PKL
model.fit(X_train, Y_train) # save the model to disk filename = 'finalized_model.sav' pickle.dump(model, open(filename, 'wb')) # load the model from disk loaded_model = pickle.load(open(filename, 'rb')) result = loaded_model.score(X_test, Y_test) Add solution -
Python 2021-10-04 06:24:02
mediafileupload python example
from __future__ import print_function import pickle import os.path from googleapiclient.http import MediaFileUpload from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests impo... Add solution -
Python 2021-09-29 19:38:05
model pickle file create
import pickle # save the model to disk filename = 'finalized_model.sav' pickle.dump(model, open(filename, 'wb')) # some time later... # load the model from disk loaded_model = pickle.load(open(filename, 'rb')) result = loaded_model.score(X_test, Y_te... Add solution -
Python 2021-09-29 05:37:02
pickle a dictionary
import pickle #credits to stack overflow user= blender a = {'hello': 'world'} with open('filename.pkl', 'wb') as handle: pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL) with open('filename.pkl', 'rb') as handle: b = pickle.load(handle)... Add solution -
Python 2021-09-20 00:01:01
load from file pickle
1 # Load the dictionary back from the pickle file. 2 import pickle 3 4 favorite_color = pickle.load( open( "save.p", "rb" ) ) 5 # favorite_color is now { "lion": "yellow", "kitty": "re... Add solution -
Python 2021-09-15 13:20:03
python selenium save cookies
# read cookies import pickle import selenium.webdriver driver = selenium.webdriver.Firefox() driver.get("http://www.google.com") cookies = pickle.load(open("cookies.pkl", "rb")) for cookie in cookies: driver.add_cookie... Add solution
Best helpers
Ranking is empty