MCPcopy
hub / github.com/dask/dask / to_csv

Function to_csv

dask/dataframe/io/csv.py:764–966  ·  view source on GitHub ↗

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, .

(
    df,
    filename,
    single_file=False,
    encoding="utf-8",
    mode="wt",
    name_function=None,
    compression=None,
    compute=True,
    scheduler=None,
    storage_options=None,
    header_first_partition_only=None,
    compute_kwargs=None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

762
763
764def to_csv(
765 df,
766 filename,
767 single_file=False,
768 encoding="utf-8",
769 mode="wt",
770 name_function=None,
771 compression=None,
772 compute=True,
773 scheduler=None,
774 storage_options=None,
775 header_first_partition_only=None,
776 compute_kwargs=None,
777 **kwargs,
778):
779 """
780 Store Dask DataFrame to CSV files
781
782 One filename per partition will be created. You can specify the
783 filenames in a variety of ways.
784
785 Use a globstring::
786
787 >>> df.to_csv('/path/to/data/export-*.csv') # doctest: +SKIP
788
789 The * will be replaced by the increasing sequence 0, 1, 2, ...
790
791 ::
792
793 /path/to/data/export-0.csv
794 /path/to/data/export-1.csv
795
796 Use a globstring and a ``name_function=`` keyword argument. The
797 name_function function should expect an integer and produce a string.
798 Strings produced by name_function must preserve the order of their
799 respective partition indices.
800
801 >>> from datetime import date, timedelta
802 >>> def name(i):
803 ... return str(date(2015, 1, 1) + i * timedelta(days=1))
804
805 >>> name(0)
806 '2015-01-01'
807 >>> name(15)
808 '2015-01-16'
809
810 >>> df.to_csv('/path/to/data/export-*.csv', name_function=name) # doctest: +SKIP
811
812 ::
813
814 /path/to/data/export-2015-01-01.csv
815 /path/to/data/export-2015-01-02.csv
816 ...
817
818 You can also provide an explicit list of paths::
819
820 >>> paths = ['/path/to/data/alice.csv', '/path/to/data/bob.csv', ...] # doctest: +SKIP
821 >>> df.to_csv(paths) # doctest: +SKIP

Callers 1

to_csvMethod · 0.90

Calls 7

delayedFunction · 0.90
warnFunction · 0.85
optimizeMethod · 0.45
to_delayedMethod · 0.45
replaceMethod · 0.45
getMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…