<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Just a couple quick examples.
Step1:  Let's suppose that down the road our probram can only handle certain carriers; an update to the data adding a new carrier would violate an assumpetion we hold. We'll use the within_set method to check our assumption
Step2:  Great, our assumption was true (at least for now).
Surely, we can't count on each flight having a Carrier, TailNum and FlightNum, right?
Step3:  Note
<ASSISTANT_TASK:>
Python Code:
# This will take a few minutes
r = requests.get("http://www.transtats.bts.gov/Download/On_Time_On_Time_Performance_2015_1.zip",
                 stream=True)
with open("otp-1.zip", "wb") as f:
    for chunk in r.iter_content(chunk_size=1024):
        f.write(chunk)
        f.flush()
r.close()
z = zipfile.ZipFile("otp-1.zip")
fp = z.extract('On_Time_On_Time_Performance_2015_1.csv')
columns = ['FlightDate', 'Carrier', 'TailNum', 'FlightNum',
           'Origin', 'OriginCityName', 'OriginStateName',
           'Dest', 'DestCityName', 'DestStateName',
           'DepTime', 'DepDelay', 'TaxiOut', 'WheelsOn',
           'WheelsOn', 'TaxiIn', 'ArrTime', 'ArrDelay',
           'Cancelled', 'Diverted', 'ActualElapsedTime',
           'AirTime', 'Distance', 'CarrierDelay', 'WeatherDelay',
           'NASDelay', 'SecurityDelay', 'LateAircraftDelay']
df = pd.read_csv('On_Time_On_Time_Performance_2015_1.csv', usecols=columns,
                 dtype={'DepTime': str})
dep_time = df.DepTime.fillna('').str.pad(4, side='left', fillchar='0')
df['ts'] = pd.to_datetime(df.FlightDate + 'T' + dep_time,
                          format='%Y-%m-%dT%H%M%S')
df = df.drop(['FlightDate', 'DepTime'], axis=1)
Explanation: Just a couple quick examples.
End of explanation
carriers = ['AA', 'AS', 'B6', 'DL', 'US', 'VX', 'WN', 'UA', 'NK', 'MQ', 'OO',
            'EV', 'HA', 'F9']
df.pipe(ck.within_set, items={'Carrier': carriers}).Carrier.value_counts().head()
Explanation: Let's suppose that down the road our probram can only handle certain carriers; an update to the data adding a new carrier would violate an assumpetion we hold. We'll use the within_set method to check our assumption
End of explanation
df.pipe(ck.none_missing, columns=['Carrier', 'TailNum', 'FlightNum'])
Explanation: Great, our assumption was true (at least for now).
Surely, we can't count on each flight having a Carrier, TailNum and FlightNum, right?
End of explanation
import engarde.decorators as ed
@ed.within_range({'Counts!': (4000, 110000)})
@ed.within_n_std(3)
def pretty_counts(df):
    return df.Carrier.value_counts().to_frame(name='Counts!')
pretty_counts(df)
Explanation: Note: this isn't too user-friendly yet. I'm planning to make the error messages more informative. Just haven't gotten there yet.
That said, you wouldn't really use engarde to determine whether or not those columns are always not null. Instead, you might find that for January every flight has all of those fields, assume that hold generally, only to be surprised when next month you get a flight without a tail number.
Decorator Interface
Each of your checks can also be written as a decorator on a function that returns a DataFrame.
I really like how slick this is.
Let's do a nonsense example. Suppose we want to show the counts of each Carrier, but our UI designer
worries that if things are too spread out the bar graph will look weird (again, silly example). We'll
assert that teh counts are within a comfortable range and that each count is within 3 standard deviations of the mean.
End of explanation
<END_TASK>