<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Some code playing with the Echonest API python wrapper
Pythondocs
Github
API Overview
Things you can do with the API
Remix part of the API
More examples with Remix
Code for examples  
Resources for the Spotify web API
Step1:  Query a single song, get its audio features and make a dataframe
Step2:  Grab and compare the hottest tracks, available in Spotify, for 2 artists on a number of audio features
<ASSISTANT_TASK:>
Python Code:
from pyechonest import config, artist, song
import pandas as pd
config.ECHO_NEST_API_KEY = 'XXXXXXXX' #retrieved from https://developer.echonest.com/account/profile
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
Explanation: Some code playing with the Echonest API python wrapper
Pythondocs
Github
API Overview
Things you can do with the API
Remix part of the API
More examples with Remix
Code for examples  
Resources for the Spotify web API:
Python wrapper
Meteor.js wrapper with links to Node.js and general client js wrappers
End of explanation
songs = song.search(title='Elastic Heart',artist='Sia',buckets='id:spotify',limit=True,results=1)
elasticHeart = songs[0]
elasticHeartFeatures = pd.DataFrame.from_dict(elasticHeart.audio_summary,orient='index')
pd.DataFrame.from_dict([elasticHeart.audio_summary])
Explanation: Query a single song, get its audio features and make a dataframe
End of explanation
floHottest = song.search(artist = 'Flo Rida' ,sort = 'song_hotttnesss-desc', buckets = 'id:spotify', limit = True, results = 20)
fsongFeatures = []
for song in floHottest:
    fsongFeatures.append(song.audio_summary)
S= pd.DataFrame.from_dict(songFeatures)
S.index = [song.title for song in siaHottest]
S['hotness'] = [song.song_hotttnesss for song in siaHottest]
F= pd.DataFrame.from_dict(fsongFeatures)
F.index = [song.title for song in floHottest]
F['hotness'] = [song.song_hotttnesss for song in floHottest]
u,idx = np.unique(S.index,return_index=True)
S = S.ix[idx,:]
u,idx = np.unique(F.index,return_index=True)
F = F.ix[idx,:]
ax = pd.DataFrame({'Flo Rida':F.mean(), 'Sia': S.mean()}).plot(kind='bar',figsize=(18,6),rot=0, color = ['lightblue','salmon']);
ax.set_title("Average Song Features for Artist's Hottest 20 tracks",fontsize=14);
ax.tick_params(axis='x', labelsize=12)
Elastic_Heart = siaHottest[5].get_tracks('spotify')
Elastic_Heart[1]
%%html
<iframe src="https://embed.spotify.com/?uri=spotify:track:3yFdQkEQNzDwpPB1iIFtaM" width="300" height="380" frameborder="0" allowtransparency="true"></iframe>
Explanation: Grab and compare the hottest tracks, available in Spotify, for 2 artists on a number of audio features
End of explanation
<END_TASK>