Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

export data 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 :: how to uninstall python idle on ubuntu 
Python :: Concat and Append DFs Python 
Python :: python version installed in ubuntu 
Python :: lock in python 
Python :: pandas save one row 
Python :: list adding to the begining python 
Python :: error urllib request no attribute 
Python :: python catch multiple exceptions 
Python :: multiple functions tkinter 
Python :: renaming multiple columns in pandas 
Python :: pandas dataframe scan column for values between numbers 
Python :: how to import model_to_dict 
Python :: python match phone number 
Python :: iterate over list and select 2 values together python 
Python :: pandas df row count 
Python :: python replace all values in a column 
Python :: python getter decorator 
Python :: IntegrityError import in django 
Python :: set pixel pygame 
Python :: bot wait_for discord py 
Python :: pandas group by multiple columns and count 
Python :: find record where dataframe column value contains 
Python :: how to set default user group in django 
Python :: select specific rows from dataframe in python 
Python :: port 5432 failed: timeout expired 
Python :: joblib 
Python :: python run shell command 
Python :: how to hide a turtle in turtle python 
Python :: measure cell execution time in jupyter notebook 
Python :: pandas difference between dates 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =