brightwind.export.export.export_csv

brightwind.export.export.export_csv(data, file_name=None, folder_path=None, **kwargs)

Export a DataFrame, Series or Array to a .csv file or a .tab. The pandas.to_csv documentation can be found at https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html

Parameters
  • data (panda.Dataframe or pandas.Series, array or list-like objects) – Dataframe, Series or Array

  • file_name (str) – The file name under which the CSV will be saved, or use the default, i.e ‘2019-06-07_brightwind_csv_export.csv’

  • folder_path (str) – The directory where the CSV will be saved, default is the working directory

  • kwargs – All the kwargs that can be passed to pandas.to_csv.

:return exports a .csv or .tab file

Example usage

import brightwind as bw
df = bw.load_campbell_scientific(bw.datasets.demo_campbell_scientific_site_data)
folder = r'C:\some\folder\'

# to export a .csv file with a specified name to a specific folder
bw.export_csv(df, file_name='brightwind_calculations', folder_path=folder)

# to export a .csv file using default settings (to the working directory using a default name)
bw.export_csv(df)

# to export a .tab file
bw.export_csv(df, file_name='file_exported.tab', sep='  ')