#!/usr/bin/env python
# coding: utf-8

# # question 1

# In[1]:


import math
def volume_calculation(radius):
    volume = (4/3)*math.pi*(radius*radius*radius)
    return volume

print("r", "v")

for r in range(1,11):
    print(r, volume_calculation(r))


# # question 2-(1)

# In[2]:


import pandas as pd
data = pd.read_csv(r"/Users/AshokLaxmi/Desktop/arthodox_txt.csv")
columndata = data.loc[:,["SentenceID","Sentencetext content"]]
print(columndata)


# # question 2-(2)

# In[17]:


import pandas as pd
data = pd.read_csv(r"/Users/AshokLaxmi/Desktop/arthodox_txt.csv")
columndata = data.loc[:,["SentenceID","Sentencetext content","Processed Sentence"]]
print(columndata)


# # Question 2(3)

# In[4]:


import pandas as pd
data = pd.read_csv(r"/Users/AshokLaxmi/Desktop/arthodox_txt.csv")
data = data.set_index(['SentenceID'])
print(data.loc['ARTHROTEC.5'])


# In[ ]:


question 3


# In[16]:


import pandas as pd
data = pd.read_csv(r'/Users/AshokLaxmi/Desktop/Assignment2_denton_housing.csv')
data = pd.DataFrame(data, columns =['year', 'title_field', 'value'])


# In[17]:


years = list(data['year'])[1:]
years = [int(y) for y in years]
values = list(data['value'])[1:]
values = [int(y) for y in values]


# In[20]:


question 3.1

vals = []
vac = []
occ = []
for e in set(years):
    vals.append(values[years.index(e)])
    vac.append(values[years.index(e) +1])
    occ.append(values[years.index(e) +2])
    diff = [abs(k-l) for l, k in zip(occ[:-1], occ[1:])]
    diff.sort()
    print(diff)


# In[43]:


question 3.2

print('year   ' + 'Vacant  '+   'Occupied    ')
for p in range(0, len(vals)): 
    k, l, g, v = vals[p], vac[p], occ[p], list(set(years))[p]
print('{}   '.format(round(v)) +'{}%    '.format(round(l*100/k)) + '{}%   '.format(round(g*100/k)))


# # question no. 3-(3)

# In[29]:


print('                         '+ 'year        ' + 'value        ')
maxVac = max(vac)
maxOcc = max(occ)
print('Vacant Housing Units     '+'{}       '.format(list(set(years))[vac.index(max(vac))]) + '{}'.format
      (maxVac))
print('Occupied Housing Units   '+ '{}      '.format(list(set(years))[occ.index(max(occ))]) + '{}'.format
      (maxOcc))   


# # question no.3-(4)

# In[14]:


#harmonic mean of total housing units
list= 49109,47888,45121,44917,44642, 39499,41194
import statistics as s
s.harmonic_mean(list)


# In[ ]:




