IT/Computer Science
[Python] 데이터 처리 & 시각화
FintechPark
2021. 8. 22. 18:00
Tree_data.csv - height 정렬 후 가장 큰 나무 한그루 출력
import pandas as pd
df=pd.read_csv("./data/tree_data.csv")
df=df.sort_values(by='height', ascending=False)
print(df.head(1))
race.csv를 읽어 데이터 시각화 처리하는 법
from matplotlib import pyplot as plt
import pandas as pd
df = pd.read_csv("./data/race.csv")
df.set_index("시간", inplace=True)
x = df["토끼"]
y = df["거북이"]
fig, ax = plt.subplots()
ax.plot(x, label = "토끼")
ax.plot(y, label = "거북이")
ax.set_xlabel("시간")
ax.set_ylabel("거리")
ax.legend(loc = 'lower right')
fig.savefig("plot.png")