<jupyter_start><jupyter_text>1. Write a python reads creates a dataframe from a URL that points to a CSV file such as the pronto data or CSVs in data.gov.<jupyter_code>import pandas as pd
def python_reader(url,name):
    df = pd.read_csv(url, header = None, names = name )
    return df

names = ['Sepal_Length', 'Sepal_Width', 'Petal_Length', 'Petal_Width', 'Class'] 
python_reader('http://mlr.cs.umass.edu/ml/machine-learning-databases/iris/iris.data',names)
df = pd.read_csv('http://mlr.cs.umass.edu/ml/machine-learning-databases/iris/iris.data', header = None, names = names)
df.head(10)<jupyter_output><empty_output><jupyter_text>2. Create the function test_create_dataframe that takes as input: (a) a pandas DataFrame and (b) a list of column names. The function returns True if the following conditions hold: 1. The DataFrame contains only the columns that you specified as the second argument.2. The values in each column have the same python type3. There are at least 10 rows in the DataFrame.<jupyter_code>def test_create_dataframe(df, colume_name):
    if colume_name in list(df.columns) and check_the_type(df,colume_name) and len(df.index) > 9:
            return True
    return False

def check_the_type(df,colume_name):
    if all (type(df[col]) == type(df[df.columns[0]]) for col in df.columns):
        return True 
    return False
names = ['Sepal_Length', 'Sepal_Width', 'Petal_Length', 'Petal_Width', 'Class']
test_create_dataframe(df, names)
df1 = df.drop('Class',1)
df1.head()
names1 = ['Sepal_Length', 'Sepal_Width', 'Petal_Length', 'Petal_Width']
test_create_dataframe(df1, names1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1162079510703364, 'fraction_numerical': 0.010397553516819572, 'mean_word_length': 5.173584905660378, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '559751', 'license': 'MIT', 'n_tokens_mistral': 564, 'n_tokens_neox': 552, 'n_words': 161, 'path': 'CSE 583 HW2 - revised.ipynb', 'repo_name': 'UWSEDS/homework-2-python-functions-and-modules-siqicheng88', 'size': '1635'}