
    biZ                       d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZ d dlmZ 	 d dlZd dlZd dlZd dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZm Z m!Z!m"Z"m#Z# d dl$m%Z& d dl'm(Z( d dl)m*Z* d dl+m,Z, d dl-m.Z. d dl/m0Z0 d dl1m2Z2m3Z3 	 	 	 	 	 d*dZ4d Z5	 	 	 	 	 d+dZ6d Z7d Z8d Z9d Z:d Z; e;       Z<	 	 	 	 	 	 	 	 	 d,dZ=dZ>d Z?  e,j                  dd !       e?ej                  d d"            ZA e?ej                  d#d$      ZB e?ej                  d%d&      ZCdd'd(ZD	 	 	 	 	 	 	 	 	 	 d-d)ZEy# e$ r dZY w xY w).    )annotationsN)Mapping)partial)BytesIO)catch_warningssimplefilterwarn)convert_legacy_task)compr)get_fs_token_paths)open)
open_files)infer_compression)CategoricalDtypeis_datetime64_any_dtypeis_float_dtypeis_integer_dtypeis_object_dtype)
read_bytes)flatten)dataframe_creation_dispatch)clear_known_categories)delayed)
asciitableparse_bytesc	                8   t               }	|r0|j                  |j                               s|	j                  |       |	j                  |       |	j	                  d        | |	fi |}
|rt        |
|       |r:|r8t        |
j                        t        |      k7  rt        d|
j                  |      |rf|\  }}}|j                  |      } |
j                  di |t        j                  j                  t        j                  t!        |
      |      |      i}
|
S )aa  Convert a block of bytes to a Pandas DataFrame

    Parameters
    ----------
    reader : callable
        ``pd.read_csv`` or ``pd.read_table``.
    b : bytestring
        The content to be parsed with ``reader``
    header : bytestring
        An optional header to prepend to ``b``
    kwargs : dict
        A dictionary of keyword arguments to be passed to ``reader``
    dtypes : dict
        dtypes to assign to columns
    path : tuple
        A tuple containing path column name, path to file, and an ordered list of paths.

    See Also
    --------
    dask.dataframe.csv.read_pandas_from_bytes
    r   zColumns do not match )r   
startswithrstripwriteseekcoerce_dtypeslistcolumns
ValueErrorindexassignpdCategorical
from_codesnpfulllen)readerbheaderkwargsdtypesr$   write_headerenforcepathbiodfcolnamepathscodes                 P/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/dask/dataframe/io/csv.pypandas_read_textr<   (   s    @ )CALL9		&IIaLHHQK		v	Bb&!7RZZ 0DM A/WEE#u{{4 RYY 
11"''#b'42H%PQ
 I    c                   g }g }g }| j                   D ]  }||v s| j                  |   ||   k7  s| j                  |   }||   }t        |      r t        |      r|j	                  |||f       ]t        |      rt        |      r|j	                  |       	 | |   j                  ||         | |<    |r|r,dj                  d t        |d       D              }	d|	z  }
d}nd}
d}t        |d	       }t        g d
|      }ddj                  d |D              z  }dj                  ||
||      }nd}|r2|rdnd}dj                  d |D              }dj                  ||      }nd}|s|r0ddz  }d|j                  t        d||g            z  }t        |      y# t        $ r2}|j	                  |||f       |j	                  ||f       Y d}~d}~ww xY w)zCoerce dataframe to dtypes safely

    Operates in place

    Parameters
    ----------
    df: Pandas DataFrame
    dtypes: dict like {'x': float}
    N
c              3  2   K   | ]  \  }}d | d|  yw)z- z
  Nr   ).0ces      r;   	<genexpr>z coerce_dtypes.<locals>.<genexpr>~   s&      &*a"QCtA5!s   c                    t        | d         S Nr   strxs    r;   <lambda>zcoerce_dtypes.<locals>.<lambda>   s    3qQRt9 r=   )keyzAThe following columns also raised exceptions on conversion:

%s

 zf

Alternatively, provide `assume_missing=True` to interpret
all unspecified integer columns as floats.c                    t        | d         S rF   rG   rI   s    r;   rK   zcoerce_dtypes.<locals>.<lambda>   s    c!A$i r=   )ColumnFoundExpectedz
dtype={%s}z	,
       c              3  4   K   | ]  \  }}}|d | d  yw)z: ''Nr   )rA   kv_s       r;   rD   z coerce_dtypes.<locals>.<genexpr>   s'      4
 )Aqqe3qcO4
s   z{table}

{exceptions}Usually this is due to dask's dtype inference failing, and
*may* be fixed by specifying dtypes manually by adding:

{dtype_kw}

to the call to `read_csv`/`read_table`.{extra})table
exceptionsdtype_kwextraz also  c              3  &   K   | ]	  }d |z    yw)z- %sNr   )rA   rB   s     r;   rD   z coerce_dtypes.<locals>.<genexpr>   s     7!7s   a  The following columns{also}failed to properly parse as dates:

{cols}

This is usually due to an invalid value in that column. To
diagnose and fix it's recommended to drop these columns from the
`parse_dates` keyword, and manually convert them to dates later
using `dd.to_datetime`.)alsocolsz

%s

z=-------------------------------------------------------------z=Mismatched dtypes found in `pd.read_csv`/`pd.read_table`.

%s)r$   r2   r   r   appendr   r   astype	Exceptionjoinsortedr   formatfilterr%   )r7   r2   
bad_dtypes	bad_dateserrorsrB   actualdesiredrC   exrX   rZ   rW   rY   	dtype_msgr]   r^   date_msgrulemsgs                       r;   r"   r"   \   s-    JIFZZ *;299Q<6!94YYq\FQiGf%*:7*C!!1fg"67 (-DW-M
   #*qELL3BqE*&  .4VAT.U B(J EJ=  J,?@
:JG,"3"3 4
-74
 #
 

 &uhe&
T 	 	%x3yy7Y77& &d&
& 	 Yx(OIIfTIx#89:
 o o ! *%%q&'&:;MM1a&))*s   F##	G,'GGc
                   |j                   j                         }
|j                  dg      j                  }t	        |t
              r[|D cg c]>  }t	        |j                  |      t              r|j                  |      j                  |@ }}|j                  |      }n|}|D ]  }d|
|<   	 t        |j                        }t        t        |            }t        t        |            }t        t        |            }|r|\  }}|D cg c]  }|j                  d   j                    }}|r|D cg c]
  } ||       }} |j"                  di |t$        j&                  j)                  t+        j,                  t/        |      t0              t3        |            i}||f}t/        |      rt5        ||      }g }|xs d\  }}t7        t/        |            D ]#  }|j9                  |r||   nd||   ||   g       % t;        j<                  t?        t@        ||||| |
|||
      |||d	d
      S c c}w c c}w c c}w )a  Convert blocks of bytes to a dask.dataframe

    This accepts a list of lists of values of bytes where each list corresponds
    to one file, and the value of bytes concatenate to comprise the entire
    file, in order.

    Parameters
    ----------
    reader : callable
        ``pd.read_csv`` or ``pd.read_table``.
    block_lists : list of lists of delayed values of bytes
        The lists of bytestrings where each list corresponds to one logical file
    header : bytestring
        The header, found at the front of the first file, to be prepended to
        all blocks
    head : pd.DataFrame
        An example Pandas DataFrame to be used for metadata.
    kwargs : dict
        Keyword arguments to pass down to ``reader``
    path : tuple, optional
        A tuple containing column name for path and the path_converter if provided

    Returns
    -------
    A dask.dataframe
    category)includeNr   )dtype)r^   )NN)	full_columnsr8   headr0   r.   r2   r4   r1   	blocksizezread-csvF)metalabelenforce_metadatar   )!r2   to_dictselect_dtypesr$   
isinstancer   getr   
categories
differencer#   tupler   
block_maskblock_mask_lastargsr5   r'   r(   r)   r*   r+   zerosr-   intsetr   ranger_   ddfrom_mapr   	_read_csv)r.   block_listsr0   ru   r1   r4   specified_dtypesr5   rv   urlpathr2   categoricalsrT   known_categoricalsunknown_categoricalsr$   blocksis_firstis_lastr8   path_converterr/   r9   ppartsis                             r;   text_blocks_to_pandasr      sW   L [[  "F %%zl%;CCL"G, "
*..q13CD $$Q'22> 
 
  ,667IJ+ " q	 4<< G7;'(FZ,-HOK01G"&)/0A000561^A&6E6t{{ 
22HHSYc2CJ
 
 %d1EF E)\NGU3v; M%eAhT8A;
KLM ;; 	
 	# [
. 16s   AH6 H;5I c       	           |\  }}}|&||t        ||   j                  j                        f}nd }d}|
j                         }|sJ|j	                  dd       d}|j                  dd        |j	                  dd      |j                  dd        |s|j                  dd        |}d}|||k7  r|
rd}n|}||d<   t        || ||||||	|	      }|r||   S |S )	NFnamesTskiprowsr0   r   
skipfooterusecols)rc   catr~   copyr}   popr<   )blockpartr$   r.   r0   r2   ru   r8   rt   r4   r1   rv   r5   r   r   	path_infor3   rest_kwargs_columnsproject_after_readr7   s                        r;   r   r   (  s     #D(G 4=$$//0
	 	 L++-K??7D)1L
D)??8Q'3OOHd+d+ Hw,6 "&H%-K	" 


B '{Ir=   c              #  T   K   | D ]  }|sd d |dd D        E d{     y7 w)z
    Yields a flat iterable of booleans to mark the zeroth elements of the
    nested input ``block_lists`` in a flattened output.

    >>> list(block_mask([[1, 2], [3, 4], [5]]))
    [True, False, True, False, True]
    Tc              3      K   | ]  }d   ywFNr   rA   rV   s     r;   rD   zblock_mask.<locals>.<genexpr>{  s     -aE-      Nr   r   r   s     r;   r   r   o  s;       .
-59---	. 	.s   (&(c              #  T   K   | D ]  }|sd |dd D        E d{    d  y7 w)z
    Yields a flat iterable of booleans to mark the last element of the
    nested input ``block_lists`` in a flattened output.

    >>> list(block_mask_last([[1, 2], [3, 4], [5]]))
    [False, True, False, True, True]
    c              3      K   | ]  }d   ywr   r   r   s     r;   rD   z"block_mask_last.<locals>.<genexpr>  s     .aE.r   NTr   r   s     r;   r   r   ~  s;       .5":...
	 	/s   (&(c                R    d}t        | |z  |z        }t        |t        d            S )N
   g    A)r   min)total_memory	cpu_countmemory_factorrv   s       r;   auto_blocksizer     s,    MLI-=>Iy#d)$$r=   c                     d} t         et               5  t        dt               t        j                         j
                  }t        j                         }d d d        rrt        ||      S | S # 1 sw Y   xY w)Ni   ignore)psutilr   r   RuntimeWarningvirtual_memorytotalr   r   )defaultmemcpus      r;   _infer_block_sizer     sm    G 	%>2'')//C""$C	%
 3!#s++N	% 	%s   AA00A9c                   | j                   }|t        |      dk(  r||d<   nd}d|v r9|j                  |d         }dj                  |d         }|r|t        |      d  }n|j                         }|
rt        |
t              rd}
d|v sd|v r|j                  d      d	urt        d
      dD ]  }||v st        | d|        |j                  d      rt        dj                  |            t        |j                  d      t              r|j                  d      x}}np|j                  d      dx}}nZt        |j                  d            }t        |      }t        t        t        t        |      dz               t        |      z
        }t        |j                  d      t              rt        d|       t        |j                  d      t              r$|
r"|j                  d      j                  |
d       }nd }|dk(  r;t!        |d|	      d   }t        |      dk(  rt#        | d      t%        |d         }|dk(  rt&        }t        |t(              rt+        |      }|r|rt-        d|z         d }|t.        vrt1        d|z        |r|r||k  r|dk7  rt-        d       |}t3        |f|||||
d|	xs i }|
r|\  }}}|
|f}n|\  }}d }t        |d   t4        t        f      s|g}|d	u r$t        |d         r|d   d   j7                         }|j                  d      }|j                  d|dnd       }||d<   |dnd}t        |t              r||z  }|j                  d      rg }|j9                  |      D ]  }|j;                         j9                  |j                  d            }t        |      dkD  rBt        |d         dkD  rB|j=                  |d   j?                         j                                n|j=                  |       t        |      |kD  s n$ n"|j9                  |t        ||z   ||z               }|sdnt        |      t        |d           z
  }|d	ur!|||z   k  rt        |      |k\  rt        d!      |d"n||   |z   }|jA                         } | jC                  d#d        | j                  d$      d%k(  rd&| d$<   	  | tE        |      fd|i| }!|
r|
|!jL                  v rt        d)|
z        |j                  d*i       }#|#i }#|rZt        |#t              rJ|!jL                  D ];  }$tO        |!|$   jP                        s|$|#vs!|!|$   jS                  tT              |!|$<   = |D %&'(cg c]L  }%|%D &'(cg c]:  }&|&jV                  jY                         D '(cg c]  \  }'}(t[        |'|(i        c}(}'< c}(}'}&N }}'}&}%}(t]        | |||!|||#|||+
      S # tF        jH                  jJ                  $ r}"d't)        |"      v rt        d(      |" d }"~"ww xY wc c}(}'w c c}(}'}&w c c}(}'}&}%w ),Nr   lineterminatorr?   encodingrM   r5   r&   	index_colFzKeywords 'index' and 'index_col' not supported, except for 'index_col=False'. Use dd.{reader_name}(...).set_index('my-index') instead)iterator	chunksizez not supported for dd.nrowszThe 'nrows' keyword is not supported by `dd.{0}`. To achieve the same behavior, it's recommended to use `dd.{0}(...).head(n=nrows)`r   r   r0   z)List of header rows not supported for dd.
convertersinferrb)modestorage_options   z resolved to no filesr   zWarning %s compression does not support breaking apart files
Please ensure that each individual file can fit in memory and
use the keyword ``blocksize=None to remove this message``
Setting ``blocksize=None``z#Compression format %s not installedz}Unexpected behavior can result from passing skiprows when
blocksize is smaller than sample size.
Setting ``sample=blocksize``)	delimiterrv   samplecompressioninclude_pathr   commentr   zSample is not large enough to include at least one row of data. Please increase the number of bytes in `sample` in the call to `read_csv`/`read_table`r=   r   enginepyarrowrB   EOFzEOF encountered while reading header. 
Pass argument `sample_rows` and make sure the value of `sample` is large enough to accommodate that many rows of datazFiles already contain the column name: %s, so the path column cannot use this name. Please set `include_path_column` to a unique name.rs   )r4   r   r5   rv   r   )/__name__r-   encoder|   boolr}   r%   rd   r   r   maxr   r   r#   	TypeErrordictr   OSErrorr   AUTO_BLOCKSIZErH   r   r	   r   NotImplementedErrorr   r   computesplitdecoder_   stripr   r   r   r(   rh   ParserErrorr$   r   rs   r`   floatdaskitemsr
   r   ))r.   r   rv   r   r   r   sample_rowsr4   assume_missingr   include_path_columnr1   reader_nameb_lineterminator
empty_blobkwlastskiprowfirstrowr   r   r9   b_outb_samplevaluesr5   r   r0   needr   r   split_commentnpartshead_kwargsru   rC   r   rB   r   dskrT   tss)                                            r;   read_pandasr     s    //K!c.&9Q&>#1 V)00
1CDYYvj12
  0J0AB)002z*=tD$&v&**["9"FY
 	
 ( I<t#9+GHHI zz' $VK0	
 	
 &**Z(#.!'J!77h	J		'!""h
 vzz*-.(ms5X!234s8}DE&**X&-CK=QRR&**\*D16IL1556I4P g"7W

 u:?WI%:;<< (a1I"	)S!	*	[) ,77	
 	%!"G+"UVVV	F 2{a7G+	

 "(  bE "'&%#^4 &fQi%/ 5S^!9Q<'')
 JJwEZZU]'EFF81AD&#Fzz)NN#34 		D KKM//

90EFM=!A%}Q'(1,LLq!1!7!7!9!@!@!BCT"5zD 		 c+"4hoF

 QUceBi-.@!@FUvd(::s8}PV?VA
 	
 NSh:J(JF ++-KOOL$'x I- #H	gh'J{JkJ  3t|| C68KL
 	
 zz'2.*%5t< 	0AQ.1<L3Lq'../Q	0  
  	
 	
 :=9IJ2 B+J	
F  !) C 99   CF?H 	
 	6 K	
sB   W4 	Y 
"X96X3X9Y 
4X0X++X03X99Y 
a  
Read {file_type} files into a Dask.DataFrame

This parallelizes the :func:`pandas.{reader}` function in the following ways:

- It supports loading many files at once using globstrings:

    >>> df = dd.{reader}('myfiles.*.csv')  # doctest: +SKIP

- In some cases it can break up large files:

    >>> df = dd.{reader}('largefile.csv', blocksize=25e6)  # 25MB chunks  # doctest: +SKIP

- It can read CSV files from external resources (e.g. S3, HDFS) by
  providing a URL:

    >>> df = dd.{reader}('s3://bucket/myfiles.*.csv')  # doctest: +SKIP
    >>> df = dd.{reader}('hdfs:///myfiles.*.csv')  # doctest: +SKIP
    >>> df = dd.{reader}('hdfs://namenode.example.com/myfiles.*.csv')  # doctest: +SKIP

Internally ``dd.{reader}`` uses :func:`pandas.{reader}` and supports many of the
same keyword arguments with the same performance guarantees. See the docstring
for :func:`pandas.{reader}` for more information on available keyword arguments.

Parameters
----------
urlpath : string or list
    Absolute or relative filepath(s). Prefix with a protocol like ``s3://``
    to read from alternative filesystems. To read from multiple files you
    can pass a globstring or a list of paths, with the caveat that they
    must all have the same protocol.
blocksize : str, int or None, optional
    Number of bytes by which to cut up larger files. Default value is computed
    based on available physical memory and the number of cores, up to a maximum
    of 64MB. Can be a number like ``64000000`` or a string like ``"64MB"``. If
    ``None``, a single block is used for each file.
sample : int, optional
    Number of bytes to use when determining dtypes
assume_missing : bool, optional
    If True, all integer columns that aren't specified in ``dtype`` are assumed
    to contain missing values, and are converted to floats. Default is False.
storage_options : dict, optional
    Extra options that make sense for a particular storage connection, e.g.
    host, port, username, password, etc.
include_path_column : bool or str, optional
    Whether or not to include the path to each particular file. If True a new
    column is added to the dataframe called ``path``. If str, sets new column
    name. Default is False.
**kwargs
    Extra keyword arguments to forward to :func:`pandas.{reader}`.

Notes
-----
Dask dataframe tries to infer the ``dtype`` of each column by reading a sample
from the start of the file (or of the first file if it's a glob). Usually this
works fine, but if the ``dtype`` is different later in the file (or in other
files) this can cause issues. For example, if all the rows in the sample had
integer dtypes, but later on there was a ``NaN``, then this would error at
compute time. To fix this, you have a few options:

- Provide explicit dtypes for the offending columns using the ``dtype``
  keyword. This is the recommended solution.

- Use the ``assume_missing`` keyword to assume that all columns inferred as
  integers contain missing values, and convert them to floats.

- Increase the size of the sample using the ``sample`` keyword.

It should also be noted that this function may fail if a {file_type} file
includes quoted strings that contain the line terminator. To get around this
you can specify ``blocksize=None`` to not split files into multiple partitions,
at the cost of reduced parallelism.
c                l     	 	 	 	 	 	 	 	 	 d fd	}t         j                  ||      |_        ||_        |S )Nc
                2    t        | f|||||||||	d	|
S )N)	rv   r   r   r   r   r4   r   r   r   )r   )r   rv   r   r   r   r   r4   r   r   r   r1   r.   s              r;   readzmake_reader.<locals>.read  sD     
  )##)+ 3
 
 	
r=   )r.   	file_type	r   Nr   i  r   FFNF)READ_DOC_TEMPLATErd   __doc__r   )r.   r   r   r   s   `   r;   make_readerr    sJ     !
8 %++;)+TDLDMKr=   pandasread_csv)backendnameCSV
read_table	delimitedread_fwfzfixed-width)	depend_onc                   |5 } | j                   |fi | d d d        t        j                  j                  |j                        S # 1 sw Y   2xY w)N)to_csvosr5   normpath)r7   filr  r1   fs        r;   
_write_csvr    sH    	 		!v77CHH%% s   AAc                   | j                         } |r|t        d      |
|}
n|
s|rt        d      t        d||dd|	xs i }t        t        d      }| j                         }|rxt        |fd|i|} ||d	   |fi |}d
|v r|n|d
z   }|j                  dd      j                  dd      }t        |fd|i|}d|d<   |dd D ]  } |||fd|i|} |g}|g}nnt        |f||| j                  d|} ||d	   |d	   fi |g}|
rd|d<   |j                  t        |dd |dd       D cg c]  \  }} |||fi | c}}       |r|
t               }|t        d| dt               |E|j                  d      4|j                  d      |k7  r t        d| d|j                  d             ||j                  d      ||d<   d	dl}t!         |j"                  |i |      S |S c c}}w )a  
    Store Dask DataFrame to CSV files

    One filename per partition will be created. You can specify the
    filenames in a variety of ways.

    Use a globstring::

    >>> df.to_csv('/path/to/data/export-*.csv')  # doctest: +SKIP

    The * will be replaced by the increasing sequence 0, 1, 2, ...

    ::

        /path/to/data/export-0.csv
        /path/to/data/export-1.csv

    Use a globstring and a ``name_function=`` keyword argument.  The
    name_function function should expect an integer and produce a string.
    Strings produced by name_function must preserve the order of their
    respective partition indices.

    >>> from datetime import date, timedelta
    >>> def name(i):
    ...     return str(date(2015, 1, 1) + i * timedelta(days=1))

    >>> name(0)
    '2015-01-01'
    >>> name(15)
    '2015-01-16'

    >>> df.to_csv('/path/to/data/export-*.csv', name_function=name)  # doctest: +SKIP

    ::

        /path/to/data/export-2015-01-01.csv
        /path/to/data/export-2015-01-02.csv
        ...

    You can also provide an explicit list of paths::

    >>> paths = ['/path/to/data/alice.csv', '/path/to/data/bob.csv', ...]  # doctest: +SKIP
    >>> df.to_csv(paths) # doctest: +SKIP

    You can also provide a directory name:

    >>> df.to_csv('/path/to/data') # doctest: +SKIP

    The files will be numbered 0, 1, 2, (and so on) suffixed with '.part':

    ::

        /path/to/data/0.part
        /path/to/data/1.part

    Parameters
    ----------
    df : dask.DataFrame
        Data to save
    filename : string or list
        Absolute or relative filepath(s). Prefix with a protocol like ``s3://``
        to save to remote filesystems.
    single_file : bool, default False
        Whether to save everything into a single CSV file. Under the
        single file mode, each partition is appended at the end of the
        specified CSV file.
    encoding : string, default 'utf-8'
        A string representing the encoding to use in the output file.
    mode : str, default 'w'
        Python file mode. The default is 'w' (or 'wt'), for writing
        a new file or overwriting an existing file in text mode. 'a'
        (or 'at') will append to an existing file in text mode or
        create a new file if it does not already exist. See :py:func:`open`.
    name_function : callable, default None
        Function accepting an integer (partition index) and producing a
        string to replace the asterisk in the given filename globstring.
        Should preserve the lexicographic order of partitions. Not
        supported when ``single_file`` is True.
    compression : string, optional
        A string representing the compression to use in the output file,
        allowed values are 'gzip', 'bz2', 'xz',
        only used when the first argument is a filename.
    compute : bool, default True
        If True, immediately executes. If False, returns a set of delayed
        objects, which can be computed at a later time.
    storage_options : dict
        Parameters passed on to the backend filesystem class.
    header_first_partition_only : bool, default None
        If set to True, only write the header row in the first output
        file. By default, headers are written to all partitions under
        the multiple file mode (``single_file`` is False) and written
        only once under the single file mode (``single_file`` is True).
        It must be True under the single file mode.
    compute_kwargs : dict, optional
        Options to be passed in to the compute method
    kwargs : dict, optional
        Additional parameters to pass to :meth:`pandas.DataFrame.to_csv`.

    Returns
    -------
    The names of the file written if they were computed right away.
    If not, the delayed tasks associated with writing the files.

    Raises
    ------
    ValueError
        If ``header_first_partition_only`` is set to False or
        ``name_function`` is specified when ``single_file`` is True.

    See Also
    --------
    fsspec.open_files
    Nz9name_function is not supported under the single file modezDheader_first_partition_only cannot be False in the single file mode.rM   )r   r   newlineF)purer   r   awrJ   r0   r   r  )r   name_functionnumzThe 'scheduler' keyword argument for `to_csv()` is deprecated andwill be removed in a future version. Please use the `compute_kwargs` argument instead. For example, df.to_csv(..., compute_kwargs={scheduler: z})	schedulerzJDiffering values for 'scheduler' have been passed in.
scheduler argument: z
via compute_kwargs: r   )optimizer%   r   r   r  
to_delayed	open_filereplacer   npartitionsextendzipr	   FutureWarningr}   r   r#   r   )r7   filenamesingle_filer   r   r  r   r   r  r   header_first_partition_onlycompute_kwargsr1   file_optionsto_csv_chunkdfs
first_filevalueappend_modeappend_filedr   filesr  r   s                            r;   r  r    s   @ 
B}0TUU"*&1#([R
 	
    b	L :E2L
--/CxCdClC
SVZ:6:!Tkdtcz!))#r2::3CK{KlK xQR 	LA KK5KFKE	L
'	

 
 s1vuQx:6:;&$F869#ab'596MNda\!Q)&)N	
 !!VN K LU+UXZ  !"";/;"";/9<''0k 2''5'9'9+'F&GI   ^%7%7%D%L*3N;'LDLL&;N;<<C Os   4G4
)NNTFN)FNNNNr   )
Fzutf-8wtNNTNNNN)F
__future__r   r  collections.abcr   	functoolsr   ior   warningsr   r   r	   dask._task_specr
   r   ImportErrornumpyr+   r  r(   fsspec.compressionr   fsspec.corer   r   r  r   fsspec.utilsr   pandas.api.typesr   r   r   r   r   dask.dataframe	dataframer   
dask.bytesr   	dask.corer   dask.dataframe.backendsr   dask.dataframe.utilsr   dask.delayedr   
dask.utilsr   r   r<   r"   r   r   r   r   r   r   r   r   r   r  register_inplacer  r  r
  r  r  r   r=   r;   <module>rF     s   " 	 #   7 7 /   $ * ) " *   !  ? 7   . 	1hXB 	nbDN.% #$ ZzH VD7&77	 bkk:u-/ kB
r{{J> &* & 	 $Je  Fs   D8 8EE