pydata / pydata/patsy

Add "numerical" function (opposite of C() in formulas)?

Open
#87 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
990
Forks
106
Avg merge
7d 34m
Merged PRs (30d)
1

Description

It would be nice to have a function, say "N( )", that indicates that input data with pandas dtype "category" should be interpreted as numerical data. In that sense this function would do the exact opposite of C().

Why on earth would I want to do this? Say I have a column 'HoD' (Hour of Day) in the input dataframe whose datatype is a pandas "category" (the data I am working with is huge, so I want to save RAM and not have millions of int64 that take only 24 values). For a simple linear model I just run a vanilla formula specification without using C() and dummy coding is done automatically, that's great. But I also want to run some non-parametric estimators, and for those I want to avoid dummy-coding data. Having such a function would allow to use the same analysis pipeline without having to convert the input data in some cases.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by tracing the existing C() formula handling and how pandas categorical dtypes are interpreted. Done means a proposed N() formula function can distinguish categorical input as numerical data while preserving the existing C() behavior, including the non-parametric estimator use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.