Skip to content

Implemented a dynamic way to create weekday names dictionary and also Changed weekday_name function to day_name as it was giving some error : "'DatetimeProperties' object has no attribute 'weekday_name' : #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
}
],
"source": [
"data['weekday']=data['Day'].dt.weekday_name\n",
"data['weekday']=data['Day'].dt.day_name()\n",
"data.head()"
]
},
Expand All @@ -243,7 +243,12 @@
"metadata": {},
"outputs": [],
"source": [
"dictionary={'Monday':1,'Tuesday':2,'Wednesday':3,'Thursday':4,'Friday':5,'Saturday':6,'Sunday':7\n",
"from calendar import weekday, day_name\n",
"days_dict={}\n",
"for day_no in range(0,7):\n"
" days_dict[day_name[day_no]]=day_no+1\n"
"#dictionary={'Monday':1,'Tuesday':2,'Wednesday':3,'Thursday':4,'Friday':5,'Saturday':6,'Sunday':7\n",
"dictionary=days_dict\n",
" \n",
" \n",
"}"
Expand Down