Answers for "how to run python script for csv"

18

python read csv

# pip install pandas 
import pandas as pd

# Read the csv file
data = pd.read_csv('data.csv')

# Print it out if you want
print(data)
Posted by: Guest on October-03-2020
0

csv manipulation python

import csv, sys
filename = 'some.csv'
with open(filename, 'rb') as f:
    reader = csv.reader(f)
    try:
        for row in reader:
            print row
    except csv.Error as e:
        sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))
Posted by: Guest on April-20-2020

Code answers related to "how to run python script for csv"

Python Answers by Framework

Browse Popular Code Answers by Language