0% found this document useful (0 votes)
5 views

Project IP coding

IP project coding

Uploaded by

sadhanathakur482
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Project IP coding

IP project coding

Uploaded by

sadhanathakur482
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import pandas as pd

import numpy as np
import matplotlib.pyplot as plt
print("."*222)
print("\t","\t","\t","\t","\t","Warm Greetings from us to you")
print("."*222)

def top10dance():
#Top 10 songs danceability with artist names
df=pd.read_csv("Spotify2.csv")
df
df=pd.read_csv("Spotify2.csv",usecols=["danceability","artist_names"])
df10=df.sort_values("danceability").head(10)
print(df10)
df10.plot(kind='bar', x="artist_names",title="Danceability Report",color="pink")
plt.ylabel('dancebility')
plt.show()

def peak_rank():
#Olivia Rodrigo songs peak rank
df=pd.read_csv("Spotify2.csv", usecols=["artist_names","peak_rank","track_name"])
df=df[df["artist_names"]=="Olivia Rodrigo"]
print(df)
plt.xlabel("track_name")
plt.ylabel("peak_rank")
plt.title("peak_rank of your best artist")
plt.plot(df.track_name,df.peak_rank ,
marker="*",markersize=10,color="red",linewidth=2,linestyle="dashdot")
plt.show()

def songs_perweekchart():
#10 songs on week chart
df=pd.read_csv("Spotify2.csv",usecols=["track_name","weeks_on_chart"])
df1=df.sort_values("track_name").head(10)
print(df1)
plt.xlabel("track_name")
plt.ylabel("weeks_on_chart")
plt.title("songs_perweekchart")
plt.plot(df1.track_name,df1.weeks_on_chart,
marker="*",markersize=7,color="green",linewidth=1,linestyle="dashdot")
plt.show()
def songs_played():
#duration_ms of artist
df=pd.read_csv("Spotify2.csv",
index_col=["artist_names"],usecols=["duration_ms","artist_names"])
df2=df.groupby("artist_names").first()

df2=df.sort_values("duration_ms", ascending=False).head(10)
print(df2)
exp=[0.1,0,0,0,0.2,0.1,0.1,0.1,0,0.1]
plot = df2.plot.pie(y='duration_ms', figsize=(7, 7),explode=exp,autopct="%2.f",legend=False)
plt.show()

while True:
print("."*222)
print("\t","\t","\t","\t","\t","MENU")
print("."*222)
print("1. Top 10 songs you can groove on ")
print("2. Get to know artist peak rank")
print("3. Top 10 songs as per week chart")
print("4. Top 10 songs played")
print("."*222)
a=input("Enter your name")
ch=int(input("Enter your choice"))
if ch==1:
print("THANK YOU" , a)
top10dance()
elif ch==2:
print("THANK YOU" , a)
peak_rank()
elif ch==3:
print("THANK YOU" , a)
songs_perweekchart()
elif ch==4:
print("THANK YOU" , a)
songs_played()

You might also like