1. 程式人生 >實用技巧 >其它 >對房源資訊的處理

對房源資訊的處理


技術標籤:筆記資料分析python

python資料分析的程式碼


```python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv('ftx_xian2.csv', encoding='gbk')
df_duplicates = df.drop_duplicates(subset='title', keep='first')
df_clean = df_duplicates[
    ['housetype', 'floor', 'orientation', 'yearbuilt', 'Street', 'area', 'unitprice']]
print(df_clean['unitprice'])
df_clean.head()
df_clean.yearbuilt.value_counts()
plt.style.use('ggplot')
df_clean.yearbuilt.hist()
df_clean.boxplot(column='unitprice',by='yearbuilt')
plt.show()
print(len(df.title.unique()))