Unnamed: 0
int64
2
987k
text
stringlengths
246
39.9k
21,725
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nBlender- python: How do I point Blender to the version of python I have installed\n [/INST] Mark, your version of Blender should be compiled with a specific version of Python interfaced t...
821,103
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython to group SQL data: I used to read the data from CSV file, while I just imported all CSV data in SQL database, but I have difficulty in extracting data using Python from SQL.\nMy or...
150,207
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHandle large data pools in python: I'm working on an academic project aimed at studying people behavior.\nThe project will be divided in three parts: \n\nA program to read the data from s...
580,205
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nASK SPARQL queries in rdflib: I\'m trying to learn SPARQL and I\'m using python\'s rdflib to train.\nI\'ve done a few tries, but any ASK query always seems to give me back a True result.\...
712,705
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython, I want to make list json.dumped But, error \'dict\' object has no attribute \'dumps\': below is my python code\nr = requests.get("https://www.googleapis.com/youtube/v3/search?part...
34,787
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nDjango + Jquery, expanding AJAX div: How can I, when a user clicks a link, open a div right underneath the link which loads it\'s content via AJAX? \nThanks for the help; I cannot find ou...
160,406
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to print a linebreak in a python function?: I have a list of strings in my code;\nA = [\'a1\', \'a2\', \'a3\' ...]\nB = [\'b1\', \'b2\', \'b3\' ...]\n\nand I want to print them separa...
858,824
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython remove one worded strings from list: words = [['hey', 'hey you'], ['ok', 'ok no', 'boy', 'hey ma']]\n\nI have a list of lists containing strings. I understand how to remove specif...
349,468
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\ncorrelation matrix in python: How do I calculate correlation matrix in python? I have an n-dimensional vector in which each element has 5 dimension. For example my vector looks like\n\n[\...
142,920
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nwrite a paragraph to a file: Ok this is simple, I want to write a huge paragraph of text to a file. I know I can do \nf=open("blah.txt",\'w\')\nf.write("blah blah \\n")\nf.write("bla blah...
46,732
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to plot an image with non-linear y-axis with Matplotlib using imshow?: How can I plot an 2D array as an image with Matplotlib having the y scale relative to the power of two of the y ...
355,845
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nsend email to localhost from localhost via python: I'm building and testing a web service on my local machine before i put it in production. I want to test the mail service. I'm using the...
322,499
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nwhy i can run python script using python not ./?: Can anyone tell me why i can\'t run python using ./ but able to use python \n-rwxr-xr-x@ 1 xxxx staff 258 14 Nov 14:08 ltry.py\n-rwxr-...
415,204
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nboost::python passing reference of python::list: I\'d really like to know if there is a possibility to pass a reference of a python list to a boost::python c++ dll. What I want to achieve...
130,653
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nCan I create a drop down combo box within a list control in wxPython?: I am creating a wx.ListCtrl (wxPython 2.8.11.0, Python 2.7) with style=wx.LC_REPORT|wx.LC_VRULES|wx.LC_SINGLE_SEL co...
239,724
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nWhere is this variable defined?: reading diveintopython3 came upon this and can't deconstruction into smaller bits i understand. \n>>> a_dict = {'a': 1, 'b': 2, 'c': 3} ...
296,407
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nChanges in import statement python3: I don't understand the following from pep-0404\n\nIn Python 3, implicit relative imports within packages are no longer\n available - only absolute im...
472,335
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython - \'ascii\' codec can\'t decode byte \\xbd in position: I\'m using LXML to scrape some text from webpages. Some of the text includes fractions. \n5½\n\nI need to get this into a...
331,911
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython - can\'t convert to int: My entire code is below (didn\'t want to miss anything). For some reason I keep getting an error where I can\'t convert a float to an int?\nimport math\n\...
404,622
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nReturn rows and columns from a 2d array using values from a 1d array in Numpy: I am trying to use the values of a 1-dim array to slice/return the rows and columns from a 2-dim array in Nu...
229,434
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPySide threading and http downloading: I\'ve had soooo much trouble getting this code to work properly!!!! It runs fine when I debug it step by step, but when running normally it just cra...
746,291
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nAnaconda Runtime Error: Python is not installed as a framework?: I\'ve installed Anaconda with the pkg installer:\nPython 2.7.10 |Continuum Analytics, Inc.| (default, May 28 2015, 17:04:4...
727,891
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nComparing dates from from two different sources: I am using Tweepy API and storing tweets in a sqlite3 database. I am able to get the date and time using a function in Tweepy. it stores t...
248,961
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nForgetting to return the result from a function: how to prevent this bug?: I sometimes forget to return result from a function:\ndef f(*args):\n # do stuff\n result = # an expression\n ...
549,592
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nNumerical accuracy loss in Python: I wish to calculate the standard error of a series of numbers. Suppose the numbers are x[i] where i = 1 ... N. To do this\nI set \naverageX = 0.0\navera...
303,369
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nIsPrime Function bug?: I wrote this function to check if a number is prime. It seems to work fine by itself however when I use it in another function, it doesn't seem to work.\nHere is my...
79,272
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nOverriding Built-in Classes (Python): How can I view and override the full definition for built in classes? I have seen the library docs but am looking for something more.\nFor e.g. is it...
721,827
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nstemming words in python: I'm using this code to stem words, here is how it works, first there's a list of suffixes, the program checks if the word has the ending same as the one in the l...
380,531
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\n2D Convolution in Python similar to Matlab's conv2: I have been trying to do Convolution of a 2D Matrix using SciPy, and Numpy but have failed. For SciPy I tried, sepfir2d and scipy.signa...
511,023
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nImplement a "like this" button in Django without refreshing page: I\'m attempting to replicate the "like project" feature used in ruby-toolbox (the heart button).\nWhen you click the "lik...
766,500
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nTkinter set new value for labels: How can I set a new value to a label in tkinter?\nI have this code, but it\'s only show a blank window\nSorry for my english and, please, if you can, exp...
397,786
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nchange background *without* a frame with matplotlib: Given this code,\nfrom pylab import *\nion()\naxes(frameon = 0, aspect = 1, polar = 1)\ngrid (True)\n\nI get the window, containing th...
240,439
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nQuerying (pretty) big relational data in Python in a reasonable amount of time?: I have a spreadsheet with about 1.7m lines, totalling 1 GB, and need to perform various queries on it. Bei...
889,664
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nError trying to inherit from pygame.midi: I am working on a program, and I want to have a class that inherits everything from pygame.midi. However, when I attempt to do this, I get this e...
239,240
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nSerialize date to url safe string in Python: I\'d like to serialize a Date in python to a URL Safe string.\nI remember in C++, I used to just take the integer representing the number of s...
501,695
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nWriting a java server for queueing incoming HTTP Request and processing them a little while later?: I want to write an Java Server may be using Netty or anything else suggested. \nThe who...
686,139
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython: How to print only the actual value from a dictionary based on a specific key value?: I have a dictionary that is dynamically generated from the results of a Splunk search. The con...
438,946
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\n"yield" in Python: I have a function called x that produces a generator like this:\na = 5\ndef x():\n global a\n if a == 3:\n raise Exception("Stop")\n a = a - 1\n yiel...
363,227
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nadvanced for loops: I have a list of lists of lists(that last list doesn't really matter) \ndata = [[[['f', 0], 'C'], [['X', 0], 'X']],\n[[['s', 1], 'X'], [['X', 0], 'X']]]\n\nIt is essen...
479,425
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nTrouble with class inheritance - Python: I\'m fairly new to python and was having trouble with an inheritance classes. This is for an online introduction to computer programming class and...
198,234
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nCalculating arithmetic mean (average) in Python: Is there a built-in or standard library method in Python to calculate the arithmetic mean (average) of a list of numbers?\n [/INST] I am n...
388,283
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to add data to a dict-like Item Field using ItemLoaders?: I\'m using Scrapy\'s XPathItemLoader, but it\'s api only documents adding values to an Item Field, but not any deeper :( I me...
94,614
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nSolving jumbled word puzzles with python?: I have an interesting programming puzzle for you:\nYou will be given two things:\n\nA word containing a list of English words put together, e.g:...
816,432
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to make push button immediately disabled?: \nHello everyone! I've found something strange on QPushButton instance. Oh, first of all, I am using..\n\nwindows 7\npython 3.4\nPyQt5\n\nMy...
472,120
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nSum Values in a Dictionary w/ respect to the Key - Python 2.7: My dictionary Dict is arranged as follows. Each key is associated with a list of values, where each value is a tuple:\nDict ...
403,783
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nDefault django-ajax-uploader with s3 backend gives MalformedXML error: I set up a test script almost exactly like in the example here:\nhttps://github.com/GoodCloud/django-ajax-uploader\n...
672,633
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPandas Python Regex : error: nothing to repeat: I have a dataframe with a couple of strange characters, "*" and "-". \nimport pandas as pd\nimport numpy as np\n\ndata = {\'year\': [2010, ...
781,148
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nhow can i search a text file of list of words from user input and print the line which contains these words?: My query here is I want to search words from a text file and print those line...
879,064
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nIterate over a dict except for x item items: I have a dict in this format:\nd_data = {'key_1':value_1,'key_2':value_2,'key_3':value_3,'key_x':value_x,'key_n':value_n}\n\nand I have to ite...
479,059
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nGet file objects inside a scope of "with" block: For example there\'s with statement:\nwith open("ACCELEROMETER", \'w\') as ACCELEROMETER,\\\n open(\'GPS\', \'w\') as GPS,\\\n open(...
918,745
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow I can insert a 3rd nested list in a already existing list in python?: I have a list called ilist which looks like this:\n[\'TCS\', 1968, [\'Mumbai\', \'Delhi\', \'Kochi\', \'Banglore\...
275,283
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\npython: extracting one slice of a multidimensional array given the dimension index: I know how to take x[:,:,:,:,j,:] (which takes the jth slice of dimension 4).\nIs there a way to do the...
288,517
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\npython threading timer on a class method: I have a code block that I use for running a piece of code every 30 secs\ndef hello():\n print "hello, world"\n t = threading.Timer(30.0, h...
773,114
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nvectorize numpy unique for subarrays: I have a numpy array data of shape (N, 20, 20) with N being some very large number.\nI want to get the number of unique values in each of the 20x20 s...
811,495
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nDjango: Obj.objects.all().values_list(list): I am trying to make a user defined queryset in django. I have tried passing in a list of values to .values_list(). This gives me AttributeErro...
46,699
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nhow to change default dateformat AAAA-MM-DD to dd/mm/yyyy in Django?: My locale dateformat is dd/mm/yyyy and Django is requering AAAA-MM-DD\nwhen the user inputs 04/11/2009 Django raises:...
231,057
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython list in a function in a class: I\'m trying to print the list created by the functions in this class- what do I need to fix? I\'m getting output from the terminal along the lines of...
560,499
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython loop for inside lambda: In my code I need to simplify as much as possible my line of code.\nEDIT: I think I\'m not clear enough - it needs to be one line of code.\nI need to put a ...
78,727
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nSQLAlchemy Relationship Filter?: can i do:\ntable.relationship.filter( column = value )\n\nto get a subset of rows for relationships? and the same for order_by?\n [/INST] relationship() ...
319,187
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nWhat alterations do I need to make for my Flask python application to use a MySQL database?: I am new to developing applications, and I have been trying to familiarize myself with doing s...
459,354
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nFlattening an array only one layer?: Is there any built-in numpy function that would get:\na=np.asarray([[[1,2],[3,4]],[[1,2],[3,4]]])\n\nAnd would return:\nb=[[1,2],[3,4],[1,2],[3,4]]\n\...
826,345
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to plot pyaudio input with matplotlib?: How can I plot on matplotlib input signal from microphone?\nI have tried to plot with plt.plot(frames) but frames is for some reason a string?\...
882,742
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow does python "throw away" variable work?: Lets say I have: \n[obj for (_, obj) in stack]\n\nThis code assumes that the first object in stack is a tuple, and throws away the first part ...
788,073
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nRunning a Java class within a Python project: I am running a Python project, yet there is one library (sikuli) that is loads easier to work with in Java. I was wondering if there was some...
570,948
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to perform a chi-squared goodness of fit test using scientific libraries in Python?: Let\'s assume I have some data I obtained empirically:\nfrom scipy import stats\nsize = 10000\nx =...
179,797
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython run Java command line arguments with incrementing variables asynchronously.: I have a java program which does individual jobs e.g. takes in a file, does some processing on it and c...
348,529
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nFinding least common elements in a list: I want to generate an ordered list of the least common words within a large body of text, with the least common word appearing first along with a ...
746,116
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nCreating a custom Spark RDD in Python: Is it possible to extend Spark's RDDs in Python to add custom operators? If it's not possible, how can one wrap Scala code for a class that extends ...
713,851
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\n'confirm_password' is an invalid keyword argument for this function: I use DRF and write registration for my blog on django. I am receiving an error with password in views.py at the follo...
627,918
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nFaster alternatives to numpy.argmax/argmin which is slow: I am using a lot of argmin and argmax in Python.\nUnfortunately, the function is very slow.\nI have done some searching around, a...
650,819
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow can I extract the metadata and bitrate info from a audio/video file in python: What I would like to do is get the metadata from audio or video files and save it to a database record, ...
301,491
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nRemote_api configuration with App Engine: Using Python, I\'m trying to connect to my AppEngine app\'s remote_api handler, but I keep getting an error. What I want to do is set up the rem...
782,055
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nWhat does a star * alone mean in a function declaration?: What does the * mean in the following code (found in the pprint library)?\ndef pformat(object, indent=1, width=80, depth=None, *,...
225,060
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython constructors and __init__: Why are constructors indeed called "Constructors"? What is their purpose and how are they different from methods in a class?\nAlso, can there be more tha...
508,553
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to concatenate String count and Int: I have a set of string count in the form of set and I want to divide it by some int value.\nExample:\n Counter({'dlr': 21, 'said': 18, 'total': 17...
739,221
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nsend_email not working in django?: I wrote a application to send a mail through django\nmodels.py\nfrom django.db import models\n\nfrom django import forms\n\nclass EmailForm(forms.Form):...
216,332
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython lists of lists order of operations: Here's a list of lists:\na = [[1,2,3],[4,5,6],[7,8,9]]\n\nTo get the number 4 from the variable 'a', I would call a[1][0] but if instead of numb...
125,177
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nConnect double-click event of QListView with method in PyQt4: Iâ\x80\x99ve got a PyQt QListView object, and I want a method to run when it is double-clicked. This should be trivial, but i...
789,768
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nMaltparser giving error in NLTK: My COde is\nfrom nltk.parse import malt\nmp = malt.MaltParser(working_dir="/other/apps/maltparser-1.8.1",mco="engmalt.poly-1.7.mco",additional_java_args=[...
721,325
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython time.sleep lock process: I want to create multi process app. Here is sample:\nimport threading\nimport time\nfrom logs import LOG\n\n\ndef start_first():\n LOG.log("First thread...
924,300
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython: How to get the closest key from the given key?: Given a dictionary:\nsample = {\n \'123\': \'Foo\', \n \'456\': \'Bar\', \n \'789\': \'Hello\', \n \'-111\': \'World\'\...
706,688
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nsubtract current time from pandas date column: I have a pandas data frame like \nx = pd.DataFrame(['05/06/2015 00:00', '22/06/2015 00:00', None], columns=['myDate'])\n\nI want to find out...
488,024
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython global variable not updating in threads: I am writing a code to use scale to update a global value VOL. The initial value of VOL can be passed to function "check_keys", however, wh...
285,555
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython - converting a list of tuples to a list of strings: I have a list of tuples that looks like this:\n[(\'this\', \'is\'), (\'is\', \'the\'), (\'the\', \'first\'), (\'first\', \'docum...
422,791
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython recursive setattr()-like function for working with nested dictionaries: There are a lot of good getattr()-like functions for parsing nested dictionary structures, such as:\n\nFindi...
941,547
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to iterate through a column in dataframe and update two new columns simultaneously?: I understand I can add a column to a dataframe and update its values to the values returned from a...
405,024
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nSpeed up feedparser: I'm using feedparser to print the top 5 Google news titles. I get all the information from the URL the same way as always.\nx = 'https://news.google.com/news/feeds?pz...
445,817
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nProblems with Encoding in Eclipse Console and Python: I guess I need some help regarding encodings in Python (2.6) and Eclipse. I used Google and the so-search and tried a lot of things b...
136,648
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\npython subprocess.Popen and ssh port forwarding in the background: I need to have functionality that would essentially emulate user creating a port forwrding with ssh. So, essentially tha...
239,292
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow can I check to see the number of iterations Newton\'s method takes to run?: So basically I want to grab the number of iterations it takes my newton\'s method to find the root, and the...
140,743
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nscrambled output from a child process run from subprocess: I\'m using the following code to run another python script. The problem I\'m facing is that the output of that script is coming ...
98,841
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nTrouble installing Django: I'm having trouble installing Django, even if I follow the instructions here: http://www.djangobook.com/en/2.0/chapter02/\nCould someone please provide baby ste...
599,793
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython3 DictWriter using CRLF instead of LF on Linux: Problem:\nIn Python 3, I\'m using csv.DictWriter to append a row to an existing file. However, CRLF line endings are being used inste...
574,921
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nHow to access theano.tensor.var.TensorVariable?: Let's say I have a matrix w of size(1152, 10) like this:\n>>> w.get_value(True)\narray([[-0.03824838, -0.02033614, 0.040734 , ..., 0.01...
982,051
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nTrying to find a quick way to get windows path: I'm new to python.\nI know how to detect which os is installed but I'm trying to find a quick way to get the windows path rather then go a-...
686,228
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython random.choice method without repeats?: I\'m trying to improve this code which asks the user to say what the state capital is when given a state, but I\'ve noticed that sometimes it...
414,735
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nPython Error: local variable referenced before assignment: Here is my code:\nimport time\n\nGLO = time.time()\n\ndef Test():\n print GLO\n temp = time.time();\n print temp\n G...
198,622
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nsql alchemy python query query.first() _and: I am modifying some code I did not write. The problem with this code is that tracking numbers have started to recycle with the carrier. So f...
202,669
{'text': '<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nCan Mustache Templates do template extension?: I\'m new to Mustache.\nMany templating languages (e.g., Django / Jinja) will let you extend a "parent" template like so...\nbase.html\n<html...
32,793
{'text': "<s>[INST] <</SYS>>\nGiven a puzzle-like code question, provide a well-reasoned, step-by-step Python solution.\n<</SYS>>\n\nDjango (?) really slow with large datasets after doing some python profiling: I was comparing an old PHP script of mine versus the newer, fancier Django version and the PHP one, with full...