<jupyter_start><jupyter_text>Scipy: We have the min and max temperatures in a city In India for each months of the year.  We would like to find a function to describe this and show it graphically, the dataset  given below. Task: 1.fitting it to the periodic function 2.plot the fit Data Max = 39, 41, 43, 47, 49, 51, 45, 38, 37, 29, 27, 25 Min = 21, 23, 27, 28, 32, 35, 31, 28, 21, 19, 17, 18 Expected Output:<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize


temp_max = np.array([39, 41, 43, 47, 49, 51, 45, 38, 37, 29, 27, 25]) 
temp_min = np.array([21, 23, 27, 28, 32, 35, 31, 28, 21, 19, 17, 18])
months = np.arange(1,13)
days = np.linspace(0, 12, num=365)



def yearly_temps(times, avg, ampl, time_offset):
    return (avg
            + ampl * np.cos((times + time_offset) * 2 * np.pi / times.max()))

res_max, cov_max = optimize.curve_fit(yearly_temps, months,
                                      temp_max, [20, 10, 0])
res_min, cov_min = optimize.curve_fit(yearly_temps, months,
                                      temp_min, [-40, 20, 0])

plt.figure()
plt.plot(months, temp_max, 'ro')
plt.plot(days, yearly_temps(days, *res_max), 'r-')
plt.plot(months, temp_min, 'bo')
plt.plot(days, yearly_temps(days, *res_min), 'b-')
plt.xlabel('Month')
plt.ylabel('Temperature ($^\circ$C)')

plt.show()<jupyter_output><empty_output><jupyter_text>Matplotlib: This assignment is for visualization using matplotlib: data to use: url=https://raw.githubusercontent.com/Geoyi/Cleaning-Titanic-Data/master/titanic_original.csv titanic = pd.read_csv(url) Charts to plot: 1. Create a pie chart presenting the male/female proportion<jupyter_code>import pandas as pd 
import matplotlib.pyplot as plt
import seaborn as sns

url="https://raw.githubusercontent.com/Geoyi/Cleaning-Titanic-Data/master/titanic_original.csv" 
titanic = pd.read_csv(url) 

plt.pie(titanic.sex.value_counts(), labels=titanic.sex.value_counts().index,autopct='%1.1f%%')
plt.show()<jupyter_output><empty_output><jupyter_text>2. Create a scatterplot with the Fare paid and the Age, differ the plot color by gender Note: Solution submitted via github must contain all the source code and final  graph. 3.Expected Output This assignment consists of 200 marks and needs to be submitted in  .ipynb format in the upcoming session for evaluation.<jupyter_code>sns.lmplot(x="fare",y="age",hue="sex", data = titanic,fit_reg=False)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1252533441426834, 'fraction_numerical': 0.0510741791649777, 'mean_word_length': 4.3652173913043475, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '628171', 'license': 'MIT', 'n_tokens_mistral': 1010, 'n_tokens_neox': 862, 'n_words': 264, 'path': 'Assignments/matplotlib assignment.ipynb', 'repo_name': 'ashwinijindal10/mywork', 'size': '2467'}