Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

export file csv

import pandas as pd

# Dataframe example
df = pd.DataFrame({'col_A':[1,5,7,8],'col_B':[9,7,4,3]})

# Save dataframe as csv file in the current folder
df.to_csv('filename.csv', index = False, encoding='utf-8') # False: not include index
print(df)

#Note: to Save dataframe as csv file in other folder use instead:

''' 
df.to_csv('Path/filename.csv', index = False, encoding='utf-8') # Replace 'Path' by the wanted folder
''';

Comment

Simple export data to CSV

<?php

$list = array (
    array('aaa', 'bbb', 'ccc', 'dddd'),
    array('123', '456', '789'),
    array('"aaa"', '"bbb"')
);

$fp = fopen('file.csv', 'w');

foreach ($list as $fields) {
    fputcsv($fp, $fields);
}

fclose($fp);
?>
Comment

PREVIOUS NEXT
Code Example
Python :: export dataframe to csv python 
Python :: python run server 
Python :: python create uuid 
Python :: export multiple python pandas dataframe to single excel file 
Python :: unzip in python 
Python :: python randomly shuffle rows of pandas dataframe 
Python :: how to split and keep delimiter at the same line in python 
Python :: python convert number to list of digits 
Python :: ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected. 
Python :: pandas add days to date 
Python :: how to convert datetime to jdatetime 
Python :: intall python3 in linux 
Python :: Flask Gmail 
Python :: networkx remove nodes with degree 
Python :: add conda env to jupyter 
Python :: os.system return value 
Python :: how to check if an application is open in python 
Python :: how to put a text file into a list python 
Python :: tkinter listbox delete all items 
Python :: python open each file in directory 
Python :: dataframe column contains string 
Python :: create dict from json file python 
Python :: flask secret key generator 
Python :: python hand tracking module 
Python :: return result from exec python 
Python :: jupyter notebook dark theme 
Python :: print first dictionary keys python 
Python :: print numpy version 
Python :: isprime function in python 
Python :: python reference script directory 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =