Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have done a small project but do not know how to read from the csv dataset file and how to return the values ​​as in the description, I hope can help me.
i have attached file to google drrive, onces agains many thanks.
Copy of data_processing_test.7z - Google Drive[^]

What I have tried:

using python read form file but have can return values as file description
Posted
Updated 25-Aug-20 5:53am
Comments
F-ES Sitecore 25-Aug-20 10:59am    
start by googling, so google "python read csv file" and you'll get lots of results and go from there.

In Python, you can read as a file:
Python
f=open('somedata.csv')
data = f.read().split('\n')
data
Reference: Python File Open[^]

OR

using numpy, you can reading CSV as:
Python
data = np.genfromtxt('somedata.csv',delimiter=";")
data
References: numpy - Reading CSV files | numpy Tutorial[^]

OR

Using Pandas, you can do something like:
Python
import pandas as pd

pd.read_csv('data.csv')

Reference: pandas.read_csv — pandas 1.1.1 documentation[^]

OR

Using csv import in Python, you can do something like:
Python
import csv

with open('eggs.csv', newline='') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
    for row in spamreader:
        print(', '.join(row))
Reference: csv — CSV File Reading and Writing — Python 3.8.5 documentation[^]

Try out!
 
Share this answer
 
v2
Quote:
How do using Python read file csv and return value anlysis

The problem I see is that data_processing_test.7z is not a csv file.
.7z file is a compressed archive usually generated by the 7Zip archive manager app.
So first step is to uncompress the archive to get the csv file.
7zip - How to read contents of 7z file using python - Stack Overflow[^]
py7zr · PyPI[^]
libarchive · PyPI[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900