——Exploring the “Ontario Climate Change Data Portal”: A Case Study in Data Exploration Prompts searchable table Examples Download csv file from internet ChatGPT prompt I want you to act as a Python developer tasked with downloading a CSV file from the internet using the provided URL: https://lamps.math.yorku.ca/OntarioClimate/data/content/grids/Historical/Monthly_2m_temperature_8964_ERA5_January1981toMarch2021.csv. To accomplish this, write a Python script that ..
Category : matplotlib
The popular initializers include RandomNormal distribution function, trancated normal distribution function, GlorotNormal function, HeNormal function and others. This example code show what are these functions and display the probability density functions of these initializers for my reference. Code: import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm x = np.linspace(-10,10,500) #default RandomNormal(mean=0.0, ..
This example pytho program define the popular activation functions and display the functions. Code: import numpy as np import matplotlib.pyplot as plt #——————————- # define the activation functions def relu(x): v=x.copy() v[x=0]=x[x>=0] v[x=alpha*x] ..
Activation function is a very important component of machine learning and deep learning. There are three types of Activation Functions: Binary Step Function; Linear Activation Function and Non-Linear Activation Functions. Available activation functions in Keras include relu, sigmoid, softmax, softplus, softsign, tanh, selu, elu and exponential. In addition,user can also create custom activation function.Below is an ..
We often need to draw multiple similar maps using the same colorbar. A good way is to use the AxesGrid from the Cartopy package. Below is one of my examples of sharing colorbars for 4 submaps. This example can also answer other questions: How to add ocean, river, lakes,coastline and province border to a map? ..
If you have grid or point data and polygon shapefiles for longitude and longitude. Using geopandas and shapely it’s easy to find grids or points in specific polygons. import geopandas as gpd import pandas as pd import numpy as np import matplotlib.pyplot as plt from shapely.geometry import Point # US state polygon shape file US_states=gpd.GeoDataFrame.from_file(‘states_province_shapefile\cb_2018_us_state_20m\cb_2018_us_state_20m.shp’) ..
We often use running averages to remove noise from time series. Below is a simple python code to do this easily. import numpy as np from numpy import random import matplotlib.pyplot as plt # your data data = random.random(size=(1,100)) # set window kernel_size = 10 # window width is 10 # set weight, you can ..
My example of Python code for mapping variables overlay with geographic information. Elements in the map include ocean, coastline,borders,lakes,rivers,province borders, contour, contourf, pcolormesh, scatter, labels, province (or state) names. Also includes information about how to set cmap, what range of the data (minimum, maximum) to show, how many levels to display the data. How to ..