背景
众所周知,亚马逊是全球最大的互联网书店。该数据集包含从2009年到2019年每年亚马逊上最畅销的前50的数据。包含550本书,使用Goodreads将数据分类为小说和非虚构类别。
导入相关包
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import plotly
import plotly.express as px
import plotly.graph_objs as go
import plotly.offline as py
from plotly.offline import iplot
from plotly.subplots import make_subplots
import plotly.figure_factory as ff
plt.rcParams['axes.unicode_minus']=False
plt.rcParams['font.sans-serif']=['SimHei']
文件导入及数据信息基本查看
df=pd.read_csv(r'E:\数据分析\数据分析案例\kaggle\bestsellers with categories.csv')
df.head()
df.info()
#数据类型无需更改
<class ‘pandas.core.frame.DataFrame’>
RangeIndex: 550 entries, 0 to 549
Data columns (total 7 columns):
Column Non-Null Count Dtype
0 Name 550 non-null object
1 Author 550 non-null object
2 User Rating 550 non-null float64
3 Reviews 550 non-null int64
4 Price 550 non-null int64
5 Year 550 non-null int64
6 Genre 550 non-null object
dtypes: float64(1), int64(3), object(3)
memory usage: 30.2+ KB
df.isnull().sum()
#数据无缺失
Name 0
Author 0
User Rating 0
Reviews 0
Price 0
Year 0
Genre 0
dtype: int64
df.nunique()
#可以看出有重复的作家,类型有两种
Name 351
Author 248
User Rating 14
Reviews 346
Price 40
Year 11
Genre 2
dtype: int64
df.duplicated().sum