Generation

generate functionWed, 01 Feb 2023

There is a Pandas dataframe: song performer chart_debut peak_position worst_position time_on_chart consecutive_weeks 450 (Can't Live Without Your) Love And Affection Nelson 1990-07-07 1 93 15 14.0 607 (Everything I Do) I Do It For You Bryan Adams 1991-06-29 1 53 9 8.0 748 (Hey Won't You Play) Another Somebody Done Som... B.J. Thomas 1975-02-01 1 99 17 16.0 852 (I Can't Get No) Satisfaction The Rolling Stones 1965-06-12 1 67 13 12.0 951 (I Just) Died In Your Arms Cutting Crew 1987-03-07 1 80 14 13.0 Create a new dfs dataframe, where the data format of the chart_debut column is changed from 1991-06-29 to 1991

import pandas as pd dfs = pd.read_csv('https://raw.githubusercontent.com/coding-blocks-archives/ML-Noida-2019-June-Two/master/datasets/hot-100.csv', parse_dates=['chart_debut']) dfs['chart_debut'] = dfs['chart_debut'].dt.year dfs.head(10)

Questions about programming?Chat with your personal AI assistant