AI

[AI ๋„์ „๊ธฐ 17์ผ์ฐจ] ์Œ์‹ ๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌํ•˜๊ธฐ

alsruds 2024. 4. 28. 18:12

๐Ÿ“ ์˜ค๋Š˜ ํ•  ์ผ ๐Ÿ“

์Œ์‹ ์˜์–‘ ์ •๋ณด ๋ฐ์ดํ„ฐ์—์„œ ๋‚ด๊ฐ€ ํ•„์š”ํ•œ ์ •๋ณด๋งŒ ๋‚จ๊ฒจ๋‘์ž !

 

๐Ÿ“Ž์‚ฌ์šฉํ•œ ๋ฐ์ดํ„ฐ ๐Ÿ“Ž

์ „๊ตญํ†ตํ•ฉ์‹ํ’ˆ์˜์–‘์„ฑ๋ถ„์ •๋ณด(์Œ์‹)ํ‘œ์ค€๋ฐ์ดํ„ฐ

 

 

๐Ÿ˜ญ ์‹œํ–‰์ฐฉ์˜ค๋“ค....

โฌ‡๏ธโฌ‡๏ธโฌ‡๏ธโฌ‡๏ธโฌ‡๏ธโฌ‡๏ธ

 

โ” csv ํŒŒ์ผ์ด ์•ˆ๋ถˆ๋Ÿฌ์™€์ ธ์š”

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbd in position 0: invalid start byte

 

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• : encoding='cp949' ์ถ”๊ฐ€ํ•˜๊ธฐ

 

 

โ” tensorflow ์„ค์น˜๊ฐ€ ์•ˆ๋ผ์š”

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\alsrud\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\tensorflow\\include\\external\\com_github_grpc_grpc\\src\\core\\ext\\filters\\client_channel\\lb_policy\\grpclb\\client_load_reporting_filter.h' HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths

 

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• : ๊ด€๋ฆฌ์ž ๊ถŒํ•œ์œผ๋กœ powershell ์‹คํ–‰ ํ›„ long path behavior ํ™œ์„ฑํ™” (์•„๋ž˜ ๋ช…๋ น ์ž…๋ ฅ)

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

Successfully installed !

 

 

๐Ÿ˜ฎ ์ผ๋‹จ ์™„๋ฃŒ .. !

 

โš™๏ธ ์ „์ฒด ์ฝ”๋“œ

import pandas as pd

# ๋ฐ์ดํ„ฐ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
data = pd.read_csv('food_nutritional_info.csv', encoding='cp949')

# ์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋กœ ๊ฐ„์ถ”๋ฆฌ๊ธฐ
selected_data = data[['์‹ํ’ˆ๋ช…', '์‹ํ’ˆ๋Œ€๋ถ„๋ฅ˜๋ช…', '๋Œ€ํ‘œ์‹ํ’ˆ๋ช…', '์˜์–‘์„ฑ๋ถ„ํ•จ๋Ÿ‰๊ธฐ์ค€๋Ÿ‰', '์—๋„ˆ์ง€(kcal)', 'ํƒ„์ˆ˜ํ™”๋ฌผ(g)', '๋‹จ๋ฐฑ์งˆ(g)', '์ง€๋ฐฉ(g)', '๋‹น๋ฅ˜(g)']]
selected_data = selected_data.fillna(0)
print(selected_data)