parameters: (
      df,
      path,
      engine="cudf",
      compression="snappy",
      index=None,
      partition_cols=None,
      partition_file_name=None,
      partition_offsets=None,
      statistics="ROWGROUP",
      metadata_file_path=None,
      int96_timestamps=False,
      row_group_size_bytes=None,
      row_group_size_rows=None,
      *args,
      **kwargs,
  )
docstring: {docstring}
docstring_summary: {docstring}
docstring_tokens: { docstring }
function: def to_parquet(
      df,
      path,
      engine="cudf",
      compression="snappy",
      index=None,
      partition_cols=None,
      partition_file_name=None,
      partition_offsets=None,
      statistics="ROWGROUP",
      metadata_file_path=None,
      int96_timestamps=False,
      row_group_size_bytes=None,
      row_group_size_rows=None,
      *args,
      **kwargs,
  ):
      """{docstring}"""
  
      if engine == "cudf":
          # Ensure that no columns dtype is 'category'
          for col in df.columns:
              if partition_cols is None or col not in partition_cols:
                  if df[col].dtype.name == "category":
                      raise ValueError(
                          "'category' column dtypes are currently not "
                          + "supported by the gpu accelerated parquet writer"
                      )
  
          if partition_cols:
              if metadata_file_path is not None:
                  warnings.warn(
                      "metadata_file_path will be ignored/overwritten when "
                      "partition_cols are provided. To request returning the "
                      "metadata binary blob, pass `return_metadata=True`"
                  )
              kwargs.update(
                  {
                      "compression": compression,
                      "statistics": statistics,
                      "int96_timestamps": int96_timestamps,
                      "row_group_size_bytes": row_group_size_bytes,
                      "row_group_size_rows": row_group_size_rows,
                  }
              )
              return write_to_dataset(
                  df,
                  filename=partition_file_name,
                  partition_cols=partition_cols,
                  root_path=path,
                  preserve_index=index,
                  **kwargs,
              )
  
          if partition_offsets:
              kwargs["partitions_info"] = list(
                  zip(
                      partition_offsets,
                      np.roll(partition_offsets, -1) - partition_offsets,
                  )
              )[:-1]
  
          return _write_parquet(
              df,
              paths=path if is_list_like(path) else [path],
              compression=compression,
              index=index,
              statistics=statistics,
              metadata_file_path=metadata_file_path,
              int96_timestamps=int96_timestamps,
              row_group_size_bytes=row_group_size_bytes,
              row_group_size_rows=row_group_size_rows,
              **kwargs,
          )
  
      else:
          if partition_offsets is not None:
              warnings.warn(
                  "partition_offsets will be ignored when engine is not cudf"
              )
  
          # If index is empty set it to the expected default value of True
          if index is None:
              index = True
  
          # Convert partition_file_name to a call back
          if partition_file_name:
              partition_file_name = lambda x: partition_file_name  # noqa: E731
  
          pa_table = df.to_arrow(preserve_index=index)
          return pq.write_to_dataset(
              pa_table,
              root_path=path,
              partition_filename_cb=partition_file_name,
              partition_cols=partition_cols,
              *args,
              **kwargs,
          )
function_tokens: def to_parquet ( df , path , engine = "cudf" , compression = "snappy" , index = None , partition_cols = None , partition_file_name = None , partition_offsets = None , statistics = "ROWGROUP" , metadata_file_path = None , int96_timestamps = False , row_group_size_bytes = None , row_group_size_rows = None , * args , * * kwargs , ) : if engine == "cudf" : # Ensure that no columns dtype is 'category' for col in df . columns : if partition_cols is None or col not in partition_cols : if df [ col ] . dtype . name == "category" : raise ValueError ( "'category' column dtypes are currently not " + "supported by the gpu accelerated parquet writer" ) if partition_cols : if metadata_file_path is not None : warnings . warn ( "metadata_file_path will be ignored/overwritten when " "partition_cols are provided. To request returning the " "metadata binary blob, pass `return_metadata=True`" ) kwargs . update ( { "compression" : compression , "statistics" : statistics , "int96_timestamps" : int96_timestamps , "row_group_size_bytes" : row_group_size_bytes , "row_group_size_rows" : row_group_size_rows , } ) return write_to_dataset ( df , filename = partition_file_name , partition_cols = partition_cols , root_path = path , preserve_index = index , * * kwargs , ) if partition_offsets : kwargs [ "partitions_info" ] = list ( zip ( partition_offsets , np . roll ( partition_offsets , - 1 ) - partition_offsets , ) ) [ : - 1 ] return _write_parquet ( df , paths = path if is_list_like ( path ) else [ path ] , compression = compression , index = index , statistics = statistics , metadata_file_path = metadata_file_path , int96_timestamps = int96_timestamps , row_group_size_bytes = row_group_size_bytes , row_group_size_rows = row_group_size_rows , * * kwargs , ) else : if partition_offsets is not None : warnings . warn ( "partition_offsets will be ignored when engine is not cudf" ) # If index is empty set it to the expected default value of True if index is None : index = True # Convert partition_file_name to a call back if partition_file_name : partition_file_name = lambda x : partition_file_name # noqa: E731 pa_table = df . to_arrow ( preserve_index = index ) return pq . write_to_dataset ( pa_table , root_path = path , partition_filename_cb = partition_file_name , partition_cols = partition_cols , * args , * * kwargs , )