code: def write(
      self,
      df,
      path,
      compression="snappy",
      index=None,
      partition_cols=None,
      **kwargs,
  ):
      self.validate_dataframe(df)
      # thriftpy/protocol/compact.py:339:
      # DeprecationWarning: tostring() is deprecated.
      # Use tobytes() instead.
  
      if "partition_on" in kwargs and partition_cols is not None:
          raise ValueError(
              "Cannot use both partition_on and "
              "partition_cols. Use partition_cols for "
              "partitioning data"
          )
      elif "partition_on" in kwargs:
          partition_cols = kwargs.pop("partition_on")
  
      if partition_cols is not None:
          kwargs["file_scheme"] = "hive"
  
      if is_s3_url(path):
          # path is s3:// so we need to open the s3file in 'wb' mode.
          # TODO: Support 'ab'
  
          path, _, _, _ = get_filepath_or_buffer(path, mode="wb")
          # And pass the opened s3file to the fastparquet internal impl.
          kwargs["open_with"] = lambda path, _: path
      else:
          path, _, _, _ = get_filepath_or_buffer(path)
  
      with catch_warnings(record=True):
          self.api.write(
              path,
              df,
              compression=compression,
              write_index=index,
              partition_on=partition_cols,
              **kwargs,
          )
  
imports: from distutils.version import LooseVersion
  from warnings import catch_warnings
  from pandas.compat import string_types
  from pandas.errors import AbstractMethodError
  from pandas import DataFrame, get_option
  from pandas.io.common import get_filepath_or_buffer, is_s3_url
label_desc: Use image node_id 2 for calling the FastParquetImpl obj's underlying member method code with example usage: obj.write(df, path, compression, index, partition_cols) without return types