Today we’ll perform data cleaning and preprocessing on a real-world dataset. Write the…
- User
Today we’ll perform data cleaning and preprocessing on a real-world dataset. Write the code to do the following: 1. Fetch the bank marketing dataset from the UCI machine learning repository. Use libraries like requests or urllib. 2. Download the zip file, unzip the contents, and read in the bank-full.csv file into a pandas dataframe (call it data).
Assistant
- Fetch the bank marketing dataset from the UCI machine learning repository. Use libraries like requests or urllib.
import requests url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/bank-marketing/bank-full.zip' # Download the zip file response = requests.get(url, stream=True) # Save the zip file with open('bank_marketing_dataset.zip', 'wb') as f: for chunk in response.iter_content(1024): f.write(chunk) # Extract the contents of the zip file with zipfile('bank_marketing_dataset.zip') as z: z.extractall()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.