In [ ]:
import geocoder
import csv
import sys
import numpy as np
from collections import Counter
import re
import time
from datetime import date
import matplotlib.pyplot as plt


#file paths
filepath1 = "full_bios_with_info.csv"

def get_bistum_string(bistum):

	bistum_str = ""

	with open(filepath1, 'rU') as f1:

        	reader1 = csv.reader(f1)

        	i = 0
       	
		count = 0		

		for row in reader1:

			if bistum in row[2]:

				if i not in [4, 7, 23, 29, 39, 47, 53]:

					name = row[6]

					dob = str(int(row[8])) + '/' + str(int(row[7])) + '/' + str(int(row[9]))

					bio = row[10]

					references = row[11]

					arrest_reason = row[3]
	
					if not any(c.isalpha() for c in arrest_reason):
						arrest_reason = "Not specified"

	
					name = "<p><b><center>" + name + "</center></b></p>"
					dob = "<p><u>Birthdate</u>: " + dob + "</p>"
					arrest_reason = "<p><u>Reason for Arrest</u>: " + arrest_reason + "</p>"
					bio = "<p><u>Biography</u>: " + bio + "</p>"
					references = "<p><u>References</u>: " + references + "</p>"

					full_bio = name + "\n" + dob + "\n" + arrest_reason + "\n" + bio + "\n" + references

					bistum_str += full_bio

					count += 1

			i = i + 1
		
		bistum_str = "<p>Here are " + str(count) + " selected biographies of clergy from this diocese:</p>" + bistum_str

		text_file = open("neatline/" + bistum + ".txt", "w")
		text_file.write(bistum_str)
		text_file.close()

	
get_bistum_string("Aachen")
get_bistum_string("Augsburg")
get_bistum_string("Berlin")
get_bistum_string("Breslau")
get_bistum_string("Freiburg")
get_bistum_string("Fulda")
get_bistum_string("Koeln")
get_bistum_string("Limburg")
get_bistum_string("Mainz")
get_bistum_string("Meissen")
get_bistum_string("Muenster")
get_bistum_string("Osnabrueck")
get_bistum_string("Paderborn")
get_bistum_string("Trier")