"{\"inputs\":\"Call has the highest mean price, while suicide has the lowest\\nPlot price for different types\\n\",\"targets\":\"tx = df[df['type'] == 'tx']\\ncall = df[df['type'] == 'call']\\ncreate = df[df['type'] == 'create']\\nsuicide = df[df['type'] == 'suicide']\\n\\nplt.hist(tx['price_gwei'], bins=4000, color='b', alpha=0.7)\\nplt.xlim(-10,100)\\nplt.title('tx', fontsize=18)\\nplt.xlabel('price', fontsize=18)\\nplt.show()\\n\\nplt.hist(call['price_gwei'], bins=4000, color='b', alpha=0.7)\\nplt.xlim(-10,100)\\nplt.title('call', fontsize=18)\\nplt.xlabel('price', fontsize=18)\\nplt.show()\\n\\nplt.hist(create['price_gwei'], bins=50, color='b', alpha=0.7)\\nplt.xlim(-10,100)\\nplt.title('create', fontsize=18)\\nplt.xlabel('price', fontsize=18)\\nplt.show()\\n\\nplt.hist(suicide['price_gwei'], bins=10, color='b', alpha=0.7)\\nplt.xlim(-10,100)\\nplt.title('suicide', fontsize=18)\\nplt.xlabel('price', fontsize=18)\\nplt.show()\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"markdowncode\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"4. Alltogether\\n\",\"targets\":\"ns1 = NS('n', dim=2).truncate(2.0, 0.8, lambda m: np.sum(np.abs(m), axis=1)) + 4\\nns2 = 2 * NS('u', dim=2).truncate(1, expr=lambda m: np.sum(m, axis=1)) - (1, 1)\\nns3 = NS('n', dim=2).truncate(1.5, expr=lambda m: np.sum(np.square(m), axis=1)) + (4, 0)\\nns4 = ((NS('n', dim=2).truncate(2.5, expr=lambda m: np.sum(np.square(m), axis=1)) * 4)\\n .apply(lambda m: m.astype(np.int)) \\/ 4 + (0, 3))\\nns = 0.4 & ns1 | 0.2 & ns2 | 0.39 & ns3 | 0.01 & ns4\\n\\nplt.imshow(np.histogramdd(ns.sample(int(1e6)), bins=100, normed=True)[0])\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"markdowncode\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"%%file my_parametrized_fixture.py\\n\\nimport pytest\\n\\ndef g(a):\\n return 2 * a\\n\\n@pytest.fixture(params=[10, 50, 100])\\ndef numbers(request):\\n return request.param\\n \\ndef test_g(numbers):\\n assert g(numbers) == numbers + numbers\\n \\ndef test_2g(numbers):\\n assert g(2*numbers) == 4 * numbers\\n\\n!py.test -v my_parametrized_fixture.py\\nGiven the above code, generate some markdown instructions for it.\\n\",\"targets\":\"\\nExtended fixtures\\nFixtures can be parametrized, which means they can take multiple values. \\nThe parameters are given as a list to the keyword params.\\nTo access these parameters inside the fixture definition, one must use the request argument and call the param attribute from request (see below in the my_parametrized_fixture.py file definition)\\nA test using a parametrized fixture will then correspond to a loop test over the parameter set of the fixture. We define here the fixture numbers that can take 3 values: 10, 50 and 100. Any test using the fixture numbers will run three times, with numbers taking respectively the value 10, 50 and 100 .\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"genmarkdown\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"6.\\nWhat combination of countries and varieties are most common? Create a Series whose index is a MultiIndexof {country, variety} pairs. For example, a pinot noir produced in the US should map to {\\\"US\\\", \\\"Pinot Noir\\\"}. Sort the values in the Series in descending order based on wine count.\\n\",\"targets\":\"country_variety_counts = ____\\n\\n# Check your answer\\nq6.check()\\n\\n#%%RM_IF(PROD)%%\\ncountry_variety_counts = reviews.groupby(['country', 'variety']).size().sort_values(ascending=False)\\n\\nq6.assert_check_passed()\\n\\n#_COMMENT_IF(PROD)_\\nq6.hint()\\n#_COMMENT_IF(PROD)_\\nq6.solution()\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"markdowncode\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"I am working on the file \\\"Day 2 - Unit 3.1.ipynb\\\".\\nThe first task is:\\n2.3.3 Combining line styles with color abbrevations\\nThe nice thing about plot is that it accepts as an argument the following convenience syntax: We can combine both line styles, marker styles and color into one single 2 (or 3 length string). Here are some examples. \\n\\n'-or' means plot a solid line, with a circle marker at the data points in red.\\n'bD' means plot a blue diamond marker scatter plot. \\n\\nWe use marker codes like this to tell plot whether to plot a line plot or a scatterplots. This is necessary because from plot point of view, there is no essential difference between one and another; a line plot (or time series plot) is created from a scatter plot by interpolating between succesive entries in the Series passed to plot. \\nHere below, we shall use this knowledge to plot a simple scatter plot to show the correlation between percentage change in stock prices of both Google (resp. 3M) and Apple.\\nCan you write Python code for it?\\n\",\"targets\":\"\\nfig3, ax3 = plt.subplots(figsize=(6,6))\\n\\nmarker = [\\\"go\\\", \\\"rD\\\"]\\nfor mark, ticker in zip(marker, tickers[1:]):\\n ax3.plot(closing_pct_change[\\\"AAPL\\\"], closing_pct_change[ticker], mark, label=ticker, alpha=0.5)\\n \\nax3.set_xlabel(\\\"AAPL Percentage change\\\")\\nax3.set_title(\\\"Correlation of Percentage changes in closing stock price\\\")\\nplt.legend(loc=\\\"best\\\")\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"taskcode\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"Astropy provides functionality for reading in and manipulating tabular\\ndata through the astropy.table subpackage. An additional set of\\ntools for reading and writing ASCII data are provided with the\\nastropy.io.ascii subpackage, but fundamentally use the classes and\\nmethods implemented in astropy.table.\\nWe'll start by importing the ascii subpackage:\\n\",\"targets\":\"from astropy.io import ascii\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"markdowncode\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"# Running in debug mode we can see all ssh arguments injected via anisble. Discuss the DEBUG output \\n!sed -i 's\\/ansible_password\\/#ansible_password\\/' inventory\\n!ansible -vvv -m ping all\\n\\n# Use this cell for the exercise\\nGiven the above code, generate some markdown instructions for it.\\n\",\"targets\":\"\\nExercise\\nComment out the ansible_password field in inventory here\\n\\nguess the expected output without running ansible\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"genmarkdown\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"## run steps of an ipyrad assembly on a specific ipcluster instance\\ndata = ip.Assembly(\\\"example\\\")\\ndata.set_params(\\\"sorted_fastq_path\\\", \\\"example_empirical_rad\\/*.fastq.gz\\\")\\ndata.run(\\\"1\\\", ipyclient=mpi)\\nGiven the above code, generate some markdown instructions for it.\\n\",\"targets\":\"\\nExample of using a Client in an ipyrad assembly\\nHere we create an Assembly and when we call the .run() command we provide a specific ipyclient object as the target to distribute work on. If you do not provide this option then by default ipyrad will look for an ipcluster instance running on the default profile (\\\"\\\").\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"genmarkdown\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"\\\".iloc()\\\"\\nPlease write code following the instructions in jupyter notebook style.\\n\",\"targets\":\"\\n# .iloc slicing at specific location - BY POSITION in the table\\n# Recall:\\n# dfg[a:b] by rows\\n# dfg[[col]] or df[[col1, col2]] by columns\\n# df.loc[a:b, x:y], by index and column values + location\\n# df.iloc[3:5,0:2], numeric position in table\\n\\ndfg.iloc[1:4,3:5] # 2nd to 4th row, 4th to 5th column\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"code\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"# Notar que los índices se indican como Major_axis\\ncloses = panel_data.ix['Adj Close']\\ncloses\\nGiven the above code, generate some markdown instructions for it.\\n\",\"targets\":\"\\nComo antes, solo nos interesan los precios de cierre ajustados...\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"genmarkdown\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"Below creates a dataframe for all jobs without salaries, then drops duplicate records from that dataframe.\\n\",\"targets\":\"## Extracting all fields with missing salaries for analysis and estimation later\\n\\nindeed.salary = indeed.salary.astype(str)\\nindeed_missing = indeed[indeed['salary'] == 'None']\\n\\n## Drop duplicate scraped records\\nindeed_missing[['title','location','company','salary']].drop_duplicates(inplace = True)\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"markdowncode\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"\\\"Changing the Objectives\\nThe objective function is determined from the objective_coefficient attribute of the objective reaction(s). Currently in the model, there is only one objective reaction, with an objective coefficient of 1.\\\"\\nPlease write code following the instructions in jupyter notebook style.\\n\",\"targets\":\"\\nmodel.objective\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"code\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"# Authors: Christopher Holdgraf \\n#\\n# License: BSD (3-clause)\\nfrom scipy.io import loadmat\\nimport numpy as np\\nfrom mayavi import mlab\\nfrom matplotlib import pyplot as plt\\nfrom os import path as op\\n\\nimport mne\\nfrom mne.viz import ClickableImage # noqa\\nfrom mne.viz import plot_alignment, snapshot_brain_montage\\n\\n\\nprint(__doc__)\\n\\nsubjects_dir = mne.datasets.sample.data_path() + '\\/subjects'\\npath_data = mne.datasets.misc.data_path() + '\\/ecog\\/sample_ecog.mat'\\n\\n# We've already clicked and exported\\nlayout_path = op.join(op.dirname(mne.__file__), 'data', 'image')\\nlayout_name = 'custom_layout.lout'\\nGiven the above code, generate some markdown instructions for it.\\n\",\"targets\":\"\\n====================================================\\nHow to convert 3D electrode positions to a 2D image.\\n====================================================\\nSometimes we want to convert a 3D representation of electrodes into a 2D\\nimage. For example, if we are using electrocorticography it is common to\\ncreate scatterplots on top of a brain, with each point representing an\\nelectrode.\\nIn this example, we'll show two ways of doing this in MNE-Python. First,\\nif we have the 3D locations of each electrode then we can use Mayavi to\\ntake a snapshot of a view of the brain. If we do not have these 3D locations,\\nand only have a 2D image of the electrodes on the brain, we can use the\\n:class:mne.viz.ClickableImage class to choose our own electrode positions\\non the image.\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"genmarkdown\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"Again we have a very strong signal present in the recording. That is always nice to see. Analysis again is then straightforward:\\n\",\"targets\":\"#run analysis\\nwd, m = hp.process(hp.scale_data(data), sample_rate)\\n\\n#visualise in plot of custom size\\nplt.figure(figsize=(12,4))\\nhp.plotter(wd, m)\\n\\n#display computed measures\\nfor measure in m.keys():\\n print('%s: %f' %(measure, m[measure]))\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"markdowncode\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"%sql select * from Students\\nGiven the above code, generate some markdown instructions for it.\\n\",\"targets\":\"\\nПроверим, что таблица создана\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"genmarkdown\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"\\\"Can you find an even better value for K?\\\"\\nPlease write code following the instructions in jupyter notebook style.\\n\",\"targets\":\"\\n# try K=1 through K=25 and record testing accuracy\\nk_range = range(1, 26)\\nscores = [] # calculate accuracies for each value of K!\\n\\n#Now we plot:\\n\\nimport matplotlib.pyplot as plt\\n# allow plots to appear within the notebook\\n%matplotlib inline\\n\\nplt.plot(k_range, scores)\\nplt.xlabel('Value of K for KNN')\\nplt.ylabel('Testing Accuracy')\\n\\n# try K=1 through K=25 and record testing accuracy\\nk_range = range(1, 26)\\nscores = []\\nfor k in k_range:\\n knn = KNeighborsClassifier(n_neighbors=k)\\n knn.fit(X_train, y_train)\\n y_pred = knn.predict(X_test)\\n scores.append(metrics.accuracy_score(y_test, y_pred))\",\"language\":\"jupyter-notebook\",\"split\":\"train\",\"template\":\"code\",\"dataset\":\"codeparrot\\/github-jupyter-text-code-pairs\",\"config\":null}\n" "{\"inputs\":\"!py.test -v spectra_analysis\\/tests\\/\\nGiven the above code, generate some markdown instructions for it.\\n\",\"targets\":\"\\n
\\n\\nEXERCISE<\\/b>:
\\nSame as above, implement tests for the two methods.

\\n\\nAdvice:\\n\\n