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 :: how to find the longest string in a list in python 
Python :: python resize image 
Python :: view whole dataset in python 
Python :: hwo much does mano house cost in python 
Python :: python remove last character from string 
Python :: split array into chunks python 
Python :: download pdf from url python 
Python :: how to find the minimum value in a dictionary python 
Python :: how calculate time in python 
Python :: show a video cv2 
Python :: parse datetime python 
Python :: how to run python script as admin 
Python :: pyqt drag and drop files 
Python :: python read file line by line 
Python :: python3 install google 
Python :: write string to file python 
Python :: remove outliers python pandas 
Python :: convert pdf to docx python 
Python :: pip code for pytube 
Python :: youtube dl download mp3 python 
Python :: how to delete na values in a dataframe 
Python :: webbrowser python could not locate runnable browser 
Python :: how to read tsv file python 
Python :: how to create dataframe in python 
Python :: python multiply list by scalar 
Python :: how to hit enter in selenium python 
Python :: install googlesearch for python 
Python :: delete unnamed 0 columns 
Python :: sklearn random forest regressor 
Python :: matplotlib add space between subplots 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =