닭 위치 플로팅하기
이제 내슈빌의 닭들이 어디에 있는지 보여주는 산점도를 만들어 볼 거예요!
이 연습은 강의의 일부입니다
Python으로 지리공간 데이터 시각화하기
연습 안내
- 닭 데이터셋 경로는 변수
chickens_path에 있어요. pandas의read_csv함수를 사용해 DataFramechickens로 불러오세요. .head()함수로 처음 몇 개 행을 확인하세요.- 다음으로
plt.scatter()에 x와 y 인자를 추가해 내슈빌 닭들의 위치를 그리세요. 마커와 색상은 기본 옵션을 사용하세요. plt.show()를 사용해 플롯을 표시하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Import pandas and matplotlib.pyplot using their customary aliases
import pandas as pd
import matplotlib.pyplot as plt
# Load the dataset
chickens = pd.____(chickens_path)
# Look at the first few rows of the chickens DataFrame
print(chickens.____())
# Plot the locations of all Nashville chicken permits
plt.scatter(x = chickens.____, y = chickens.____)
# Show the plot
plt.show()