def init_simulation_with_data_frame(self, input_data_frame = None, period = None, simulation = None, entity = None):
        """
        Initialize the simulation period with current input_data_frame for an entity if specified
        """
        assert input_data_frame is not None
        assert period is not None
        assert simulation is not None
        used_as_input_variables = self.used_as_input_variables
        id_variable_by_entity_key = self.id_variable_by_entity_key
        role_variable_by_entity_key = self.role_variable_by_entity_key

        variables_mismatch = set(used_as_input_variables).difference(set(input_data_frame.columns))
        if variables_mismatch:
            log.info(
                'The following variables used as input variables are not present in the input data frame: \n {}'.format(
                    sorted(variables_mismatch)))
        if variables_mismatch:
            log.debug('The following variables are used as input variables: \n {}'.format(
                sorted(used_as_input_variables)))
            log.debug('The input_data_frame contains the following variables: \n {}'.format(
                sorted(list(input_data_frame.columns))))

        id_variables = [
            id_variable_by_entity_key[_entity.key] for _entity in simulation.entities.values()
            if not _entity.is_person]
        role_variables = [
            role_variable_by_entity_key[_entity.key] for _entity in simulation.entities.values()
            if not _entity.is_person]

        for id_variable in id_variables + role_variables:
            entity_key = entity.key if entity is not None else None
            if (entity_key is not None) and (not simulation.entities[entity].is_person):
                assert id_variable in [id_variable_by_entity_key[entity], role_variable_by_entity_key[entity]], \
                    "variable {} for entity {} is not valid (not {} nor {})".format(
                        id_variable,
                        entity_key,
                        id_variable_by_entity_key[entity_key],
                        role_variable_by_entity_key[entity_key],
                        )
                continue
            assert id_variable in input_data_frame.columns, \
                "Variable {} is not present in input dataframe".format(id_variable)

        input_data_frame = self.filter_input_variables(input_data_frame = input_data_frame, simulation = simulation)

        index_by_entity_key = dict()

        for key, entity in simulation.entities.items():
            if entity.is_person:
                entity.count = entity.step_size = len(input_data_frame)
            else:
                entity.count = entity.step_size = \
                    (input_data_frame[role_variable_by_entity_key[key]] == 0).sum()
                unique_ids_count = len(input_data_frame[id_variable_by_entity_key[key]].unique())
                assert entity.count == unique_ids_count, \
                    "There are {0} person of role 0 in {1} but {2} {1}".format(
                        entity.count, entity.key, unique_ids_count)

                entity.members_entity_id = input_data_frame[id_variable_by_entity_key[key]].astype('int').values
                entity.members_legacy_role = input_data_frame[role_variable_by_entity_key[key]].astype('int').values
                index_by_entity_key[entity.key] = input_data_frame.loc[
                    input_data_frame[role_variable_by_entity_key[entity.key]] == 0,
                    id_variable_by_entity_key[key]
                    ].sort_values().index

        for column_name, column_serie in input_data_frame.iteritems():
            if role_variable_by_entity_key is not None:
                if column_name in role_variable_by_entity_key.values():
                    continue

            if id_variable_by_entity_key is not None:
                if column_name in id_variable_by_entity_key.values():
                    continue

            entity = simulation.get_variable_entity(column_name)
            if entity.is_person:
                init_variable_in_entity(entity, column_name, column_serie, period)
            else:
                init_variable_in_entity(entity, column_name, column_serie[index_by_entity_key[entity.key]], period)