code: def test_to_encode_features(pd_es):
      f1 = IdentityFeature(pd_es["log"].ww["product_id"])
      f2 = IdentityFeature(pd_es["log"].ww["value"])
      f3 = IdentityFeature(pd_es["log"].ww["datetime"])
  
      features = [f1, f2, f3]
      feature_matrix = calculate_feature_matrix(
          features,
          pd_es,
          instance_ids=[0, 1, 2, 3, 4, 5],
      )
  
      feature_matrix_encoded, _ = encode_features(
          feature_matrix, features
      )
      feature_matrix_encoded_shape = feature_matrix_encoded.shape
  
      # to_encode should keep product_id as a string and datetime as a date,
      # and not have the same shape as previous encoded matrix due to fewer encoded features
      to_encode = []
      feature_matrix_encoded, _ = encode_features(
          feature_matrix,
          features,
          to_encode=to_encode,
      )
      assert (
          feature_matrix_encoded_shape != feature_matrix_encoded.shape
      )
      assert (
          feature_matrix_encoded["datetime"].dtype == "datetime64[ns]"
      )
      assert feature_matrix_encoded["product_id"].dtype == "category"
  
      to_encode = ["value"]
      feature_matrix_encoded, _ = encode_features(
          feature_matrix,
          features,
          to_encode=to_encode,
      )
      assert (
          feature_matrix_encoded_shape != feature_matrix_encoded.shape
      )
      assert (
          feature_matrix_encoded["datetime"].dtype == "datetime64[ns]"
      )
      assert feature_matrix_encoded["product_id"].dtype == "category"
  
file_path: featuretools/featuretools/tests/synthesis/test_encode_features.py
imports: import pandas
  import pytest
  from featuretools import EntitySet, calculate_feature_matrix, dfs
  from featuretools.feature_base import Feature, IdentityFeature
  from featuretools.primitives import NMostCommon
  from featuretools.synthesis import encode_features
label_desc: Use image node_id 4 for calling a global function with example usage: test_to_encode_features(pd_es) without return types