- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 17
- Posts with Upvotes
- 14
- Upvoting Members
- 11
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
Re: You need to post an attempted effort before anyone will help you with homework. | |
Re: Your best bet is to load all the datafiles into a pandas dataframe. This is the de-facto structure for handling labeled array data, and also has a ton of utilities for data manipulation ESPECIALLY timestamp. post an example of one of your files, maybe the first 30 lines, including header, … | |
Re: The cached property is definatly the best suggestion. If not using that, I would get in the habit of using try: except in these situations. That is syntactially simple and very common, so others reading your code will be able to deduce your intent from the code. | |
Re: Look at python library collections, particularlu the Counter class. | |
Re: I can't really digest the entirety of your code just by looking at it, but another thing you might wanna look into is the polymonial support in numpy. There are some functions, mostly for fitting polynomicals of Nth order to other curves, that might be useful to you. For example: … | |
Re: outstring=' '.join([str(i) for i in range(0,105,5)]) file.write(outstring) Also, it's a good habit not to use the word "file" as this is a python reserved file. I'd recommend outfile or just o. | |
Re: If you use numpy, then you want to avoid iterating item by item. In fact, the whole reason to use numpy, is that you don't have to do this. If you do do this, you get no speed increase over plain python (the speed increase is about 1000-fold btw). You … | |
Re: Can you elaborate on this, your question isn't clear to me. | |
Hi guys, This feels like something that should be possible in Python, and something that I feel like I should know how to do. Image I have a list of numbers: items=[10,20,30] Let's say I wanted iterate over them and define two new variables, a and b. a=[] b=[] for … | |
Re: Can you put all the zipped values into its own list. `allvalues=[zip(ar1.values, br1.values, ar0.values, br0.values), zip(ar2.values, br2.values, ar1.values, br1.values) ... etc]` Then iterate over just this: for zippedvals in allvalues: for w,x,y,z in zippedvals: val = (sqrt((w.data**2)+(x.data**2)))-(sqrt((y.data**2)+(z.data**2))) files[0].write(('%6.20f\n') % (val)) | |
Re: Why not just split at "enclosure_url" rather than "title" and keep only the half you want? | |
Re: I noticed a few things. First, there's no reason to put the entire code into a function (eg main). This is fine, but not mandatory. There's a special line at the bottom of your code that you should add so that if this program is called as an import from … | |
Hi guys, I am running a costly simulation and trying to optimize the output. I'd have a fixed range over which the parameter of interest can vary, and about 100 values it can take in between. We know the result we are looking for and want to find the parameter … | |
Hi guys, I've downloaded 2 cached_property implementations from the internet and both did not work correctly for my programs. Does anyone here used a cached_property function that works really well and could share with me? | |
Re: Install ubuntuu. It is a free oerating system, basically virus free and better than windows. | |
Re: Also, python is going to round (9/5) to 2 since these are integers. Get in the habit of using floats: (9.0/5.0) | |
Re: Bump on snippsat's reply... That is almost certainly the way to do it if you ask me. | |
Re: If you're using linux, this may be handled more simply with a bash script. | |
Re: Bump tot he above poster, it is most certainly better to store variables so they may be accessed by attribute (eg movie.director) | |
Hi, I'm having some difficulty reading in boolean values from a file, particularly false values. Python can understand false values as empty strings, as well as a few other ways. For example: In [43]: bool(0) Out[43]: False In [44]: bool(False) Out[44]: False In [45]: bool('') Out[45]: False The problem is, … | |
Re: Are you sure that's something you can do out of the box with the software development kit provided by google? I know google provides a Python scripting layer for Android development, so that might be a good place to start. | |
Hi, I am trying to create the most general function possible to test if an object passed into it has mutability or not. With some prior help from pytony, it seemed that the best way to do this is to try to set and attribute. If the attribute can be … | |
Re: I would starting working with the Enthought Tool Suite. Their TraitsUI (and now the new Enaml framework) are worth investing the time into. They allow for really simple GUI's that are interactive from the door. In your case, it would be as simple as having a checkbox and when the … | |
Re: Well that just blew my mind. Is it actually quicker to define the pali() function than it would be to just put that expression into the generator expression? EG max((a*b, a, b) for a in range(999, 100, -1) for b in range(a, 100000//a, -1) if str(a*b))==str(a*b)[::-1]) I ask because sometimes … | |
Re: Can't you do: list_of_lists=[list(x) for x in list_of_tuples] This should make a list of lists; however, as PyTony said, this step should not be necessary for implicit compatibility w/ numpy. | |
Re: I know that[ HDF5 for python](http://alfven.org/wp/hdf5-for-python/) understands the concept of chunking and may be a good place to start if you're interested in learning more about handling large data. | |
Re: Not sure how to do this but for handling the images, start with PIL (python image library). PyAudio is probably the goto package for handling audio in python and not sure about video. | |
Re: If you're using a unix-based operating system (aka not windows), you can use the subprocess module to execute shell commands. In effect, you would run latex at the command line through Python. http://docs.python.org/library/subprocess.html Looks like you are using windows though so I'm not quite sure. Sorry | |
Re: Don't use "List" as your variable name, this is a reserved python keyword. Try replacing it with something like "mylist". Also, python's list have building count features so you can do something like: for x in mylist: print x, mylist.count(x) |