How to encode Days of a week in Python?
DATA MUNGING DATA CLEANING PYTHON MACHINE LEARNING RECIPES PANDAS CHEATSHEET     ALL TAGS

How to encode Days of a week in Python?

How to encode Days of a week in Python?

This recipe helps you encode Days of a week in Python

0
This python source code does the following: 1. Creates your own time-series using pandas 2. Handling parameters of series function 3. Extracting Weekdays names from the dates
In [1]:
## How to encode Days of a week in Python 
def Kickstarter_Example_44():
    print()
    print(format('How to encode Days of a week in Python',
                 '*^82'))

    import warnings
    warnings.filterwarnings("ignore")

    # Load library
    import pandas as pd

    # Create dates
    dates = pd.Series(pd.date_range('11/9/2018', periods=3, freq='M'))

    # View data
    print()
    print(dates)

    # Show days of the week
    print()
    print(dates.dt.weekday_name)

Kickstarter_Example_44()
**********************How to encode Days of a week in Python**********************

0   2018-11-30
1   2018-12-31
2   2019-01-31
dtype: datetime64[ns]

0      Friday
1      Monday
2    Thursday
dtype: object

Relevant Projects

Identifying Product Bundles from Sales Data Using R Language
In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

Music Recommendation System Project using Python and R
Machine Learning Project - Work with KKBOX's Music Recommendation System dataset to build the best music recommendation engine.

Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

Solving Multiple Classification use cases Using H2O
In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

Data Science Project on Wine Quality Prediction in R
In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

Perform Time series modelling using Facebook Prophet
In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

Forecast Inventory demand using historical sales data in R
In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

Predict Macro Economic Trends using Kaggle Financial Dataset
In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.