numeconcopenhagen / introprog-exercises Goto Github PK
View Code? Open in Web Editor NEWIntroductionary programming exercises
License: MIT License
Introductionary programming exercises
License: MIT License
IntroProg-exercises/PS3/problem_set_3.ipynb
Lines 310 to 338 in 93a6867
IntroProg-exercises/PS3/A10.py
Lines 1 to 19 in 93a6867
Even if you copy the defined functions
in the A10.py
-program, the notebook
will throw an error
- if you run the code as follows,
def assets_row_by_row(x,R,Y):
return R*(x['inc']-x['con'])+Y
def assets_all_at_once(income,consumption,R,Y):
return R*(income-consumption)+Y
def assets_adj(assets,R,Y):
assets *= R
assets += Y
R = 1.2 # return rate
Y = 1 # income
try:
dt['assets_1'] = R*(dt['inc']-dt['con'])+Y
dt['assets_2'] = dt.apply(assets_row_by_row,axis=1,args=(R,Y))
dt['assets_3'] = assets_all_at_once(dt['inc'].values(),dt['con'].values(),R,Y)
dt['assets_4'] = dt['inc']-dt['con']
assets_adj(dt['assets_4'],R,Y)
except Exception as e:
print(f'An error occurred: {e}')
dt.head()
An error occurred: 'numpy.ndarray' object is not callable
The subtle difference lies, I believe, in the use of df.values
and df.values()
, the latter uses numpy
the former is pandas
-syntax. Is this intended, so we are aware of this difference or is it a bug?
It took a while to debug, and now I am curious.
IntroProg-exercises/PS0/problem set 0.lyx
Lines 602 to 605 in 58313b8
Gives a syntax
-error. Should be,
\begin_layout Plain Layout
print('just right')
\end_layout
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.