Matplot lib Error“AttributeError:'AxesSubplot'对象没有属性'get'”

2024-04-26 04:05:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我不知道怎么解决这个问题? 有人能帮我吗?你知道吗

我首先在某些属性中分离日期时间,以便 一些不同的图形。你知道吗

uber2015 ['Pickup_date'] = pd.to_datetime(uber2015['Pickup_date'], format = '%Y-%m-%d %H:%M:%S')
uber2015 ['DayofWeekNum'] = uber2015['Pickup_date'].dt.dayofweek
uber2015['Month'] = uber2015['Pickup_date'].dt.month
uber2015['Hour'] = uber2015['Pickup_date'].dt.hour
uber2015['Day'] = uber2015 ['Pickup_date'].dt.day
print(uber2015.head(5))
# Uber pickups by Hour in NYC
sns.set_style('whitegrid')
ax = uber2015 = sns.countplot(x= "Hour", data=uber2015, color="lightsteelblue")
ax.set_xlabel('Hour of the Day', fontsize = 12)
ax.set_ylabel('Count of Uber Pickups', fontsize = 12)
ax.set_title('Uber Pickups by HOur in NYC (Jan-Jun 2015)', fontsize = 16)
ax.tick_params(labelsize = 8)
plt.show()

Tags: ofindatebydtaxsetnyc