当前位置:网站首页>[data preparation and Feature Engineering] perceived data

[data preparation and Feature Engineering] perceived data

2022-06-23 02:36:00 LoneRanger

The data in the file

1.CSV file

Standard read file format

import pandas as pd 
df = pd.read_csv(csv_file) 
df

Let the data in the first column be indexed

pd.read_csv(csv_file, index_col=0)

2.Excel file

Standard read file format

import pandas as pd 
df = pd.read_excel(xls_file) 
df

3. Graphic files

Read the picture

from PIL import Image    
color_image = Image.open("test.png")   
color_image

Turn to grayscale

from PIL import Image    
gray_image = Image.open("test.png").convert("L") 
gray_image

Color is three channel

import numpy as np
color_array = np.array(color_image)
color_array.shape # Color is three channel 

The grayscale image is a two channel image

gray_array = np.array(gray_image)
gray_array.shape # The grayscale image is a two channel image 

Data in the database

( To be added )

Data on the web

( To be added )

come from API The data of

( To be added )

原网站

版权声明
本文为[LoneRanger]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202021821078469.html