code: def infer_schema(df):
      from collections import OrderedDict
  
      # TODO: test pandas string type and boolean type once released
      types = {
          "Int32": "int32",
          "int32": "int32",
          "Int64": "int",
          "string": "str",
          "boolean": "bool",
      }
  
      def convert_type(column, in_type):
          if in_type == object:
              return "str"
          if in_type.name.startswith("datetime64"):
              # numpy datetime type regardless of frequency
              return "datetime"
          if str(in_type) in types:
              out_type = types[str(in_type)]
          else:
              out_type = type(np.zeros(1, in_type).item()).__name__
          if out_type == "long":
              out_type = "int"
          return out_type
  
      properties = OrderedDict(
          [
              (col, convert_type(col, _type))
              for col, _type in zip(df.columns, df.dtypes)
              if col != df._geometry_column_name
          ]
      )
  
      if df.empty:
          warnings.warn(
              "You are attempting to write an empty DataFrame to file. "
              "For some drivers, this operation may fail.",
              UserWarning,
              stacklevel=3,
          )
  
      # Since https://github.com/Toblerity/Fiona/issues/446 resolution,
      # Fiona allows a list of geometry types
      geom_types = _geometry_types(df)
  
      schema = {"geometry": geom_types, "properties": properties}
  
      return schema
  
imports: import os
  from packaging.version import Version
  from pathlib import Path
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_integer_dtype
  import pyproj
  from shapely.geometry import mapping
  from shapely.geometry.base import BaseGeometry
  from geopandas import GeoDataFrame, GeoSeries
  from urllib.parse import urlparse
  from urllib.parse import uses_netloc, uses_params, uses_relative
  import urllib.request
  from geopandas._compat import PANDAS_GE_20
label_desc: Use image node_id 18 for calling a global function with example usage: infer_schema(df) and returns: schema, out_type, str, str