<jupyter_start><jupyter_text>I visited capetown in 2018. It was my first international travel so the city remains special to me. I would love to go back there one day. Inspired by this, i choose to do a brief weather analysis on it to know the best time to visit. I cannot wait to have a taste of the fine Stellenbosch wine!The goal here is to have fun sooo remember this next line of code!!<jupyter_code>pip install emoji<jupyter_output>Requirement already satisfied: emoji in c:\users\hp\anaconda3\lib\site-packages (1.2.0)
Note: you may need to restart the kernel to use updated packages.<jupyter_text>Getting Data I got the data from http://www.wunderground.com/history and downloaded it to my local PC as a CSV file.<jupyter_code>import pandas as pd
df = pd.read_csv ("C:\\Users\\hp\\Documents\\Downloads\\Data Analysis-Pandas\\Data Analysis-Pandas-2\\CapeTown_CPT_2014.csv")
#lets check the data to see if we got it right
df.head()<jupyter_output><empty_output><jupyter_text>perfect! If you want to a certain number of rows, you can pass the number to the df.head() but otherwise it gives 5 as default  Cleaning the dataThe next step will be refining our data. In some cases as a data scientist, you will be required to analyse data that you were not involved in collecting and as a result, there may be many unnecessary details in the data. (well this may also happend when you collect data yourself!). It is therefore key to clean your data and have only what is important for you 1. First we need to clean up the data. Lets rename the superfulous column name 'WindDirDegrees' to 'WindDirDegrees<jupyter_code>df = df.rename(columns = {'WindDirDegrees<br />' : 'WindDirDegrees'})<jupyter_output><empty_output><jupyter_text>2. Remove the HTML tag<jupyter_code>df['WindDirDegrees'] =df['WindDirDegrees'].str.rstrip('<br />')
df.dtypes<jupyter_output><empty_output><jupyter_text>Change the value in the WindDirDegrees to float and the GMT to datetime<jupyter_code>df['WindDirDegrees'] = df['WindDirDegrees'].astype('float64')   
df['Date'] = pd.to_datetime(df['Date'])


#change default index to the datetime64

df.index = df['Date']<jupyter_output><empty_output><jupyter_text>Great. we are all set regarding our data types  Finding a summer break A quick wiki search says that summer in Capetown is from November to march. Thats perfect timing because my birthday is in November!! (Doing a happy dance here.<jupyter_code>from datetime import datetime

summer = df.loc[datetime(2014,1,1) : datetime(2014,3,16)]
#Lets fnd the super warm days so we know when to hit the beach in those bikini bodies! haha
summer[summer['Mean TemperatureC'] >= 25]
%matplotlib inline
#Lets visualize this in a line graph
summer['Mean TemperatureC'].plot(grid=True, figsize=(10,5),legend= "top left")<jupyter_output><empty_output><jupyter_text>looks like we have fairly warm days distributed throughout the whole perioid. Lets check for rainy days as well. From what i remember, morning showers were a common thing in capetown<jupyter_code>summer[['Mean TemperatureC', 'Precipitationmm']].plot(grid=True, figsize=(10,5))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08586019789339291, 'fraction_numerical': 0.013086498563676987, 'mean_word_length': 5.6257928118393234, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '26580', 'license': 'MIT', 'n_tokens_mistral': 1007, 'n_tokens_neox': 935, 'n_words': 390, 'path': 'Nelly Nyaga - WT-21-164/Project 1 Weather Project CapeTown .ipynb', 'repo_name': 'ruthwaiharo/Week-5-Assessment', 'size': '3133'}