728x90
반응형
일요일[주말이 너무 짧다..]
1. 코드 수정
import requests
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import json
import re
import pandas as pd # 데이터를 저장하고 처리하는 패키지
import matplotlib as mpl # 그래프를 그리는 패키지
import matplotlib.pyplot as plt # 그래프를 그리는 패키지
import csv
import matplotlib.dates as mdates
import os
df = pd.read_csv('data/seoulreal.csv',encoding='utf-8')
df.sort_values(by='redate', ascending=False) #정렬
df.drop(columns=['lostSEQ','state','dateofreceipt','details','place','ID','name','region','company','thing','views','ext'], inplace=True) #사용하지 않는 값 삭제
#isno = None만 찾아주는 것
pd.isna(df)
df = df_new.dropna() #결측치 제거
# 'redate' = 날짜
# fileAll = os.listdir(df)
# fileCsv = [filePath + file[:-4] for file in fileAll if file.endswith('.csv')] # csv에만 적용해라
# for file in fileCsv:
# df = pd.read_csv(file + '.csv')
# print(file, len(df))
d_ = df
plt.figure(figsize=(10,5))
plt.rc('font',family='Malgun Gothic')
plt.title("분실일자의 그래프")
plt.hist(d_["kinds"])
df
# plt.plot(d_["dateofreceipt"], d_["views"], "-", color='grey', label=str(spot_))
# plt.grid()
# plt.legend(fontsize=13)
# plt.xticks(rotation=90)
# plt.show()
# spot_ = 184
# d_ = df[(df["kinds"]==spot_) & (df["dateofreceipt"]<"2019-09-02")]
# plt.figure(figsize=(10,5))
# plt.title("시간대별 추이(2019년 9월 1일)", fontsize=15)
# ax = plt.subplot(1,1,1)
# ax.plot(d_["dateofreceipt"],d_["views"], "-o", color='red', label=str(spot_))
# ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M:%S'))
# plt.legend(fontsize=13)
# plt.grid()
# plt.show()
# redate등록일자 dateofreceipt분실일자 kinds 종류
# seoul_df = df.loc[[]]
# seoul_df
Out[91]:
dateofreceiptkinds01234...275516275517275518275519275520
2022-01-06 00:00:00.0 | 핸드폰 |
2022-01-05 00:00:00.0 | 기타 |
2022-01-04 00:00:00.0 | 핸드폰 |
2022-01-04 00:00:00.0 | 서류봉투 |
2022-01-04 00:00:00.0 | 기타 |
... | ... |
2007-09-15 00:00:00.0 | 기타 |
2007-03-27 00:00:00.0 | 핸드폰 |
2007-02-06 00:00:00.0 | 핸드폰 |
2007-01-30 00:00:00.0 | 기타 |
2006-12-04 00:00:00.0 | 지갑 |
275517 rows × 2 columns

tomorrow wish list
. 수업 정신차리고 똑바로 듣기
. 무너지지 않기
. 어제 적은 블로그 code 기재하기
728x90
반응형
'IT To do and To was' 카테고리의 다른 글
22년 1월 11일_팀프로젝트 마지막(small) (0) | 2022.01.11 |
---|---|
22년 1월 10일_데이터 프레임, pandas more the deep (0) | 2022.01.10 |
22년 1월 8일_개인 small project made, python그래프 (0) | 2022.01.09 |
22년 1월 7일_데이터 예측에 따른 연산 및 머신러닝 기초 중 기초 (0) | 2022.01.07 |
22년 1월 6일_젤네일 이상한가..?ㅜㅜ (0) | 2022.01.06 |