Skip to content

Instantly share code, notes, and snippets.

View abhishek-shrm's full-sized avatar

ABHISHEK SHARMA abhishek-shrm

  • ZS Associates
  • New Delhi, India
View GitHub Profile
df['reading_time']=df['reviews.text'].apply(lambda x: textstat.reading_time(x))
print('Reading Time of upvoted reviews=>',df[df['reviews.numHelpful']>1]['reading_time'].mean())
print('Reading Time of not upvoted reviews=>',df[df['reviews.numHelpful']<=1]['reading_time'].mean())
df['cleaned']=df['reviews.text'].apply(lambda x: x.lower())
df['cleaned']=df['cleaned'].apply(lambda x: re.sub('\w*\d\w*','', x))
df['cleaned']=df['cleaned'].apply(lambda x: re.sub('[%s]' % re.escape(string.punctuation), '', x))
import folium
m=folium.Map(location=[28.644800, 77.216721])
m
from branca.element import Figure
fig=Figure(width=550,height=350)
m1=folium.Map(width=550,height=350,location=[28.644800, 77.216721],zoom_start=11,min_zoom=8,max_zoom=14)
fig.add_child(m1)
m1
# Creating Basemap
fig3=Figure(width=550,height=350)
m3=folium.Map(location=[28.644800, 77.216721],tiles='cartodbpositron',zoom_start=11)
fig3.add_child(m3)
#Adding markers to the map
folium.Marker(location=[28.695800, 77.244721],popup='Default popup Marker1',tooltip='Click here to see Popup').add_to(m3)
folium.Marker(location=[28.645800, 77.214721],popup='<strong>Marker3</strong>',tooltip='<strong>Click here to see Popup</strong>').add_to(m3)
folium.Marker(location=[28.655800, 77.274721],popup='<h3 style="color:green;">Marker2</h3>',tooltip='<strong>Click here to see Popup</strong>').add_to(m3)
# Creating Basemap
fig4=Figure(height=350,width=550)
m4=folium.Map(location=[28.4911091,77.0867361],tiles='cartodbpositron',zoom_start=11)
fig4.add_child(m4)
# Adding Custom Markers
folium.Marker(location=[28.4211091,77.0267361],popup='Custom Marker 1',tooltip='<strong>Click here to see Popup</strong>',icon=folium.Icon(color='red',icon='none')).add_to(m4)
folium.Marker(location=[28.4411091,77.1167361],popup='Custom Marker 2',tooltip='<strong>Click here to see Popup</strong>',icon=folium.Icon(color='green',prefix='glyphicon',icon='off')).add_to(m4)
folium.Marker(location=[28.4511091,77.1667361],popup='Custom Marker 3',tooltip='<strong>Click here to see Popup</strong>',icon=folium.Icon(color='purple',prefix='fa',icon='anchor')).add_to(m4)
folium.Marker(location=[28.4911091,77.0867361],popup='Custom Marker 4- <b>Analytics Vidhya</b>',tooltip='<strong>Click here to see Popup</strong>',icon=folium.features.CustomIcon('av.png',icon_size=(50,50))).add_to(m4)
coords_1=[[28.65685,77.21899],[28.65699,77.21898],[28.65699,77.21898],
[28.65702,77.21875],[28.65702,77.21875],[28.6547,77.21902],[28.65308,77.21921],
[28.65286,77.21926],[28.65255,77.21938],[28.65227,77.21954],[28.65152,77.22005],
[28.64655,77.22346],[28.64643,77.22354],[28.64635,77.22357],[28.64623,77.2236],
[28.64616,77.22363],[28.64612,77.22364],[28.64557,77.22364],[28.64525,77.22365],
[28.64525,77.22365],[28.64517,77.22366],[28.64515,77.22367],[28.64512,77.22367],
[28.64504,77.22369],[28.64493,77.22371],[28.64483,77.22373],[28.64462,77.22377],
[28.6445,77.22381],[28.64444,77.22383],[28.64439,77.22387],[28.64434,77.2239],
[28.64429,77.22395],[28.64421,77.22403],[28.64417,77.22412],[28.64407,77.22429],
[28.64391,77.22465],[28.64353,77.22539],[28.64282,77.22678],[28.64282,77.22678],