mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-22 04:55:06 +00:00
lf_csv: read csv file row wise
This commit is contained in:
@@ -21,6 +21,7 @@ INCLUDE_IN_README
|
|||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pandas import *
|
from pandas import *
|
||||||
|
from csv import reader
|
||||||
|
|
||||||
class lf_csv:
|
class lf_csv:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
@@ -53,6 +54,18 @@ class lf_csv:
|
|||||||
print("value of column", value)
|
print("value of column", value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def read_csv_row(self, file_name):
|
||||||
|
lst = []
|
||||||
|
with open(str(file_name), 'r') as read_obj:
|
||||||
|
# pass the file object to reader() to get the reader object
|
||||||
|
csv_reader = reader(read_obj)
|
||||||
|
# Iterate over each row in the csv using reader object
|
||||||
|
for row in csv_reader:
|
||||||
|
# row variable is a list that represents a row in csv
|
||||||
|
print(row)
|
||||||
|
lst .append(row)
|
||||||
|
print("list", lst)
|
||||||
|
return lst
|
||||||
def main():
|
def main():
|
||||||
test = lf_csv()
|
test = lf_csv()
|
||||||
test.generate_csv()
|
test.generate_csv()
|
||||||
|
|||||||
Reference in New Issue
Block a user