def calculate_tf(matrix, movie_lengths):
	"""Method that calculates TF values for each character over each movie"""
	# Copy the input char_movie_float_time matrix, as output TF matrix would be in the same format
	tf = matrix.copy()
	for character in tf.index:
		for movie in tf.columns:
			# Filling out the cells with TF values for those cells having time values only
			if str(tf.loc[character][movie]) != 'nan':
				tf.loc[character][movie] = tf.loc[character][movie] / float(movie_lengths[movie])
	return tf