[英]How to import csv file based on date in python? The file path is absolute
[英]How to import data from absolute path in a csv using pandas?
import pandas as pd
from PIL import Image
import numpy as np
def load_image( infilename ) :
img = Image.open( infilename )
img.load()
data = np.asarray( img, dtype="int32" )
return data
df = pd.read_csv (r'Path where the CSV file is stored\File name.csv')
for i in range(len(df)) :
print(load_image(df.iloc[i, 0]))
如果您想直接使用,可以將返回的值存儲在列表中。
您可以使用 pandas read_csv
function。
import pandas as pd
df = pd.read_csv (r'Path where the CSV file is stored\File name.csv')
print (df)
資料來源: https://datatofish.com/import-csv-file-python-using-pandas/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.