Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Things equal to nothing else are equal to each other.


devel / comp.lang.python / Recoding Categorical to Numerical

SubjectAuthor
o Recoding Categorical to NumericalJohn Griner

1
Recoding Categorical to Numerical

<mailman.389.1628897654.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=14602&group=comp.lang.python#14602

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: johndavi...@gmail.com (John Griner)
Newsgroups: comp.lang.python
Subject: Recoding Categorical to Numerical
Date: Fri, 13 Aug 2021 18:33:22 -0400
Lines: 73
Message-ID: <mailman.389.1628897654.4164.python-list@python.org>
References: <CADQyvyN+nGnNDJBkkmaKKGawBGiZJOztMFnshTgsLDNTm8XbTg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de NxWVgsPrzdIFuQ6Lr9+u8QAMm9p3XE2LL59fGCfcoZpg==
Return-Path: <johndavidgriner74@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=LoGkcJKH;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.041
X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'url:icon': 0.05;
'url:webmail': 0.05; 'variable': 0.05; 'despite': 0.07;
'8bit%:41': 0.09; 'numeric': 0.09; 'column': 0.16; 'forth,': 0.16;
'lambda,': 0.16; 'variable.': 0.16; 'url:utm_term': 0.23; 'to:addr
:python-list': 0.23; 'url:icon-envelope-tick-round-orange-
animated-no-repeat-v1': 0.26; 'again,': 0.27; 'url:sig-email':
0.27; 'virus-free.': 0.28; 'to:name:python-list@python.org': 0.28;
'url:ipmcdn': 0.31; 'thanks,': 0.31; 'else,': 0.32; 'message-
id:@mail.gmail.com': 0.33; 'using': 0.33; 'url:link': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'trying': 0.36; 'received:209.85': 0.38; 'url-ip:104.85.5.152/32':
0.38; 'received:209': 0.38; 'url:avast': 0.40; 'skip:w 10': 0.61;
'url:gif': 0.62; 'url:amp': 0.62; 'town': 0.65; 'four': 0.66;
'url-ip:95/8': 0.66; 'url-ip:95.101/16': 0.69; '8bit%:18': 0.70;
'8bit%:38': 0.71; 'conversion.': 0.84; 'etc..': 0.84; '8bit%:45':
0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:from:date:message-id:subject:to;
bh=i3SUYqP1RhGIbcaFby/52iVdXZ4L1r2by/tfwclKQ0M=;
b=LoGkcJKHHMQ0WanXL3IGDlaH5a/xUdlBKbiiYhnCk+ogi5O10Kg9oVVMm7Gw7YuEF/
t5+v+7G8l29EWx5rKxKXvf+lCm7X5uKfSkB0MLA6fr3iUwu1Ce15mpG4Bs1gNLtcHxey
c/8yDlbm4ix6HOh9idRP0laRsvVXMKQWHgtCH+72tsngXq5raeuPT8luvarTo8cdSH4q
i3ze1qt2Wf7AV5yJiOzLuwv9fKI74WOL/YH0wkYfICZF8Ox0p6NVs1QwCTorjofrII2S
WQpE+zWUrWYxX4T9xlfKyWJ0YInYoR/F5H+gYQd4+SJit0drcJDc9iPW8h4onym3xOEp
8LAw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=i3SUYqP1RhGIbcaFby/52iVdXZ4L1r2by/tfwclKQ0M=;
b=BiCVjf8w20dhXgOX/FiOmK69WUQDaClBmd27r06L3Me1O08k9Puj/bu247iCTBTxYv
tPBjNzRRV++6BeAbjGrMHBLLf6n35ncef59t3D/WHN4YTg4eRpN/L8k1jxd7PQZEJeHj
FvwWSOURwXuiRCQRpQSWIRf1AgvpoGHenPV6KLSUZDaaVOwr+yGoyNfe/9+7To1qLkmf
xSIYg85rrXx5NSAXvoA42yKUNYVqfl8EqZssq1N3ga366y6yj+kYWNfS/kTy9mVRYxOZ
uqN8HvV+dyQkgeB7Th1nlHpaK2vzJXDvl4op6NAbpCTbzy2UjJghMT+B9CvW11pd5nGH
aD0w==
X-Gm-Message-State: AOAM531B8oI7ZVsRRgxIV9q2wTTBIpkgYN8+6u7v2Hnn+T5PuFqXG6ws
hXg4mUhoqb/OI4JfE0KV67mdMotvQeqyVzl95QzWoZt642M=
X-Google-Smtp-Source: ABdhPJzOLKEWwLITTkYSjadA76rlUeuc0iQ0YRUgqt3L/px315TvPi3pMjI2HjZnbMCnbl3cuDqw9UzjzTJUDzhjsH4=
X-Received: by 2002:a37:3d0:: with SMTP id 199mr4655142qkd.324.1628894012437;
Fri, 13 Aug 2021 15:33:32 -0700 (PDT)
X-Mailman-Approved-At: Fri, 13 Aug 2021 19:34:12 -0400
X-Content-Filtered-By: Mailman/MimeDel 2.1.34
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CADQyvyN+nGnNDJBkkmaKKGawBGiZJOztMFnshTgsLDNTm8XbTg@mail.gmail.com>
 by: John Griner - Fri, 13 Aug 2021 22:33 UTC

Hello, and thanks in advance,

I am trying to recode categorical variable to numeric. Despite using
lambda, If else, dummy-recoding, and so forth, what I get is from ONE
column that has 4 variables (City, Town, Suburb, Rural), I get FOUR columns:

localeDummy_City localeDummy_Town localeDummy_Suburb
localeDummy_Rural locale_recode

with the corresponding numeric variable.

What I want is the recode to have ONE column that has the numeric
conversion.

For instance:

local_recode

2

4

4

6

2

8

6

2

8

2

2

4

6

4

8

and so forth, where I have set City to 2, and Town to 4, etc.

Again, thanks, John

loca

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor