Advertisement
Vitaliy_Novichikhin

10.5.5/6 Удалите строки, в которых отсутствует значение в столбце 'genre_name'

Mar 7th, 2022
1,360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import pandas as pd
  2. df = pd.read_csv('music_log_upd_col.csv')
  3. # меняем пустые ячейки на unknown
  4. df['track_name'] = df['track_name'].fillna('unknown')
  5. df['artist_name'] = df['artist_name'].fillna('unknown')
  6. # удаляем строки с пустым жанром
  7. df = df.dropna(subset=['genre_name'])
  8. print(df)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement