View read_data_gmplot.py
import pandas as pd | |
import gmplot | |
data = pd.read_csv('3D_spatial_network.csv') | |
data.head() |
View scatter-plot-gmplot.py
# latitude and longitude list | |
latitude_list = data['LATITUDE'] | |
longitude_list = data['LONGITUDE'] | |
# center co-ordinates of the map | |
gmap = gmplot.GoogleMapPlotter( 56.730876,9.349849,9) | |
# plot the co-ordinates on the google map | |
gmap.scatter( latitude_list, longitude_list, '# FF0000', size = 40, marker = True) |
View category_encoders_dataframe.py
import pandas as pd | |
import category_encoders as ce | |
# create a Dataframe | |
data = pd.DataFrame({ 'gender' : ['Male', 'Female', 'Male', 'Female', 'Female'], | |
'class' : ['A','B','C','D','A'], | |
'city' : ['Delhi','Gurugram','Delhi','Delhi','Gurugram'] }) | |
data.head() |
View encodeda_data.py
# One Hot Encoding | |
# create an object of the One Hot Encoder | |
ce_OHE = ce.OneHotEncoder(cols=['gender','city']) | |
# transform the data | |
data = ce_OHE.fit_transform(data) | |
data.head() |
View progress_apply_data.py
import pandas as pd | |
from tqdm._tqdm_notebook import tqdm_notebook | |
from pysal.lib.cg import harcdist | |
tqdm_notebook.pandas() | |
data = pd.read_csv('3D_spatial_network.csv') | |
data.head() |
View calculate_distance.py
# calculate the distance of each data point from # (Latitude, Longitude) = (58.4442, 9.3722) | |
def calculate_distance(x): | |
return harcdist((x['LATITUDE'],x['LONGITUDE']),(58.4442, 9.3722)) | |
data['DISTANCE'] = data.progress_apply(calculate_distance,axis=1) |
View pandas_profiling.py
import pandas as pd | |
import pandas_profiling | |
# read the dataset | |
data = pd.read_csv('add-your-data-here') | |
pandas_profiling.ProfileReport(data) |
View read_time_series_data.py
import pandas as pd | |
data = pd.read_excel('sales-data.xlsx') | |
data.head() |
View convert_data_time.py
data['date'] = pd.to_datetime(data['date']) |
View resample-data.py
data.set_index('date').groupby('name')["ext price"].resample("M").sum() |
OlderNewer