<jupyter_start><jupyter_text>COMP 3122 - Artificial Intelligence with Python__Week 3 lab__ [github.com/kamrik/ML1](https://github.com/kamrik/ML1)  Book sections for this week* Chapter 2. Introduction to NumPy, sections 2.3 - 2.8* Chapter 4. Visualization with Matplotlib (parts)* Chapter 3. Pandas, sections 3.0 - 3.4<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Lab exercise `exercises/plotting_basics.ipynb`(Extended since last week)  PandasBook chapter 3  Home reading - https://www.wintellect.com/using-pandas-to-analyze-sales-data/ - OfficeSupplies.csv file here: https://www.superdatascience.com/tableau/<jupyter_code>import pandas as pd
df = pd.read_csv("../exercises/OshawaWeather2016.csv")
# df = pd.read_csv("../exercises/OshawaWeather2016.csv", usecols=["Day", "Total Precip (mm)"], index_col='Day')
# df.rename({'Day':'day', 'Total Precip (mm)':'precip'}, axis="columns", inplace=True)
df.head()
weather = np.loadtxt("../exercises/OshawaWeather2016.csv", skiprows=1, delimiter=',')
weather
df.values
# use .all()
df.values == weather
df.head()
df['Total Precip (mm)'].tail()

df.columns
df.columns = ['day', 't_max', 't_min', 't_avg', 'precip']
df.head()
ax = df.plot(y="Day")

####
plt.xlabel("Row number (index)")
plt.ylabel("Day number")
df['day'][300]
df = df.set_index('day')
df.tail()
df.tail()
df['t_max'][365]
dft = df[10:15].drop(columns=['precip'])
dfp = df[12:17].drop(columns=['t_min', 't_max', 't_avg'])
dfp['precip'] / dft['t_avg']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18558673469387754, 'fraction_numerical': 0.029336734693877552, 'mean_word_length': 6.0675675675675675, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, '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': '329671', 'license': 'Apache-2.0', 'n_tokens_mistral': 637, 'n_tokens_neox': 603, 'n_words': 120, 'path': 'ML1/lectures/03_week_lab.ipynb', 'repo_name': 'Mosuswalks/AI-with-Python', 'size': '1568'}