I am reading this frame from file:
df = pd.read_csv('playlist.csv')
and fetching all values under column 'track':
tracks = df['track'].tolist()
then I have a new_df with the same order of columns as 'playlist.csv':
new_df = pd.DataFrame(columns=['artist','track', 'value'])
and, given other_tracks = ['Once', 'Jeremy'], I would to add the entire row of some tracks to the new_df
for track in tracks:
if track in other_tracks:
row = df[df['track']==track]
how do I do it?
is there a simple way of doing this?