【发布时间】:2020-04-24 18:13:30
【问题描述】:
我之前只在这里发过一次,如果格式关闭,请原谅我。我还要说这是一个学校项目。
无论如何,我只是在学习 pandas、数据处理和 csv,并且正在创建目录。我的代码应该采用用户输入的文件并按艺术家、专辑、标题、持续时间和流派对其进行格式化。我的问题是我需要创建一个名为 print_songs 的函数,它获取数据帧并通过调用 print_song 的每一行对其进行迭代,老实说,我不知道从哪里开始。我已经把我的代码放在下面。非常感谢任何有助于理解数据处理和 pandas 的帮助或资源。
def load_catalog():
user_input = input("Please upload a file you want to read:")
user_file = pd.read_csv(user_input)
return user_file
print(load_catalog())
def print_song(Artist, Album, Title, Duration, Genre):
print("Artist: ")
print("Album: ")
print("Title: ")
print("Duration: ")
print("Genre: ")
def print_songs():`
【问题讨论】:
标签: python pandas data-processing