Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Mechanics
#8
My understanding is as follows:
1. patsy parse the formula string (or Formula object).
2. patsy lookup the execution environment to find any names that have been bound to objects in the execution environment from 1. The code for this is in https://github.com/pydata/patsy/blob/mas...sy/eval.py Maybe there are other parts too (e.g. here, where it use EvalEnvironment class which will be used to look up any variables referenced in termlists that cannot be found in data_iter_maker - e.g. your case of Y which is name not found in the dataframe passed as data argument), but this looks like the main part of the code that deals with the matter.
I really don't wanna go into details there - it's really very low level and as the comment at the beginning state
Quote:# Utilities that require an over-intimate knowledge of Python's execution environment.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Coding Mechanics - by 321brian - Dec-01-2020, 12:58 PM
RE: Coding Mechanics - by buran - Dec-01-2020, 01:48 PM
RE: Coding Mechanics - by 321brian - Dec-02-2020, 11:30 AM
RE: Coding Mechanics - by buran - Dec-02-2020, 12:04 PM
RE: Coding Mechanics - by 321brian - Dec-02-2020, 12:45 PM
RE: Coding Mechanics - by buran - Dec-02-2020, 01:43 PM
RE: Coding Mechanics - by 321brian - Dec-03-2020, 12:01 PM
RE: Coding Mechanics - by buran - Dec-03-2020, 02:25 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020