15,175 Topics
| |
Hi, I want to identify the datatypes of the te entire dataframe and group it as String, Number and Date. Required Output: Attributes Datatype A String B Number C String As of now I am using the code: for col_number in range(len(data_frame.columns)): datatype = data_frame[data_frame.columns[col_number]].apply(type).unique()[0] if (datatype is np.str or … | |
I know to access tasklist of our machine can be done through os.popen('tasklist').read(). Is there any way to read the tasklist (taskmanager data) of other systems connected in a network using Python? Just reading them will be fine. Purpose: Main objective of this is to write a script which will … | |
All, I have this very basic script that's producing some odd output. What I need to do is constantly ping a server, and when/if that server stops responding, I want to write the timestamp and " timed out" to a file. We're trying to lock down a time as to … | |
| I have a series of (~950KB) '.txt' output files from a computational chemistry program; Each file will contain the line '****optimisation achieved****' at least once and, depending on the result of the calculation, possibly twice. Does the following code, in which I am trying to find specific lines and print … |
| I have the following directory/file setup (this is simplified): Ce +---top.txt +---X0.0 | | | +---Y0.0 | | | | | +---X0.0Y0.0Z0.0.dat | | +---X0.0Y0.0Z0.05.dat | +---Y0.05 | | | +---X0.0Y0.05Z0.0.dat | +---X0.0Y0.05Z0.05.dat +---X0.05 | +---Y0.0 | | | +---X0.0Y0.0Z0.0.dat | +---X0.0Y0.0Z0.05.dat +---Y0.05 | +---X0.0Y0.05Z0.0.dat +---X0.0Y0.05Z0.05.dat Within each Y directory, … |
0 down vote favorite I am trying to read float numbers from a Binary file using Struct module and then storing them in numpy 3D arrays.When I run it as an independent script, it works fine.But when I call it as a class's function from another script(after import) it gives … | |
I need to retrieve all the filenames ending with .xml extension from all the subdirectories present in a directory and copy those names into a new .xml file. | |
hi guys, I'm new to python and i can't seem to understand this one line of code right here: distance, coordinates = min([(someFunction(state, coordinates), coordinates) for coordinates in coordinatesList]) coordinatesList contains a list of paired coordinates (x,y). someFunction returns an int. My question is why isn't distance and coordinates contain … | |
write a program that stimulates flipping a coin 100 times and then displays the total number of heads and total number of tails achieved | |
Hello, I am working on a Tk program that generates geometric patterns, and I have written into all of my defs that if the variable "outline" is True it will draw a black outline, otherwise it will draw an outline the same as the fill. I tried a function called … | |
I have a database with the following structure: lat lon id 19.7 -95.2 1 19.7 -94.7 1 19.3 -93.9 1 19 -93.5 1 19 -92.8 1 19.2 -92.6 1 19.9 -93 1 20 -92.8 1 23.1 -100.2 2 23.2 -100 2 23.3 -100 2 23.3 -100.2 2 23.4 -99 2 … | |
So! I'm building a GUI for an application I'm currently developing and I'm having a bit of trouble figuring out an issue. I'll try to explain it as best as I can in the code lines. Basically, I built a class to handle the initial window for the program, but … | |
The syntax of the [icode]str.format()[/icode] method described in [url=http://docs.python.org/library/string.html#formatstrings]the python 2.6 documentation[/url] looks both powerful and complex. The idea of this thread is to start a collection of nice formatting examples which will ease the task of mastering this function. Please post useful examples, and document them :) | |
def main(): #this program calculates the total price of a meal after inputting cost of food #tip and sales tax print ('Welcome to the Meal Calculator Program') print() #get the cost of food using the input function food_cost = input ("Please enter the price of your meal: ") food_cost = … | |
Hi, i have this output from a SQL query : new = (('{reason:slash,data:{"SET0":"=SET2"}}',), ('{reason:slash,data:{"""REM_1""": """=0xFF""", """REM_2""": """=0x1""", """SET0:REM_3""": """=SET2:REM_3""", """MREM_4""": """=0xFF"""};{}}',)) I am trying to get it such that i put all these items in a dic in the following manner : {'MREM_4': '=0xFF', 'REM_2': '=0x1', 'REM_1': '=0xFF', 'SET0:REM_3': '=SET2:REM_3'} … | |
From http://pymbook.readthedocs.org/en/latest/modules.html I've added some code to this code to make a little header for my code snippets as an exersise. """ Bars Module ============ This is an example module with provide different ways to print bars. """ def starbar(num): ''' (int) -> integer Prints a bar with * >>> … | |
I can't find anything to help me out on this method of sorting. How do I do it? | |
hi to all i want to use c program in python or in other way i want to run c program from python | |
def main(): print ('Welcome to the mpg calculator program') print() #get the miles driven using the input function miles_driven = input ("Please enter miles driven: ") miles_driven = float (miles_driven) #get the gallons used using the input function gallons_used = input ("Please enter gallons used: ") galons_used = float (gallons_used) … | |
develop a program which asks for a name and a password,and prints an acceptance message if the name is "aladdin" and the password is "sesane".the program should print a reject message in all other cases.this should be achived by combining the two tests into one using the "and"key word | |
This error frustrates me when I want to iterate over the elements of a set, for example when trying to convert the set to a list. How do I get around it? | |
Hi guys, I need some help with lists or dicts. I have a list with 2 columns like this "123.04 241.30","232.00" [and so on for about 400 lines] and another list which is more complex: "val1","val2","val3","nnn.nn nnn.nn","232.00" (where "n" is a number) [some thousands lines] Now I want to compare … | |
Hey guys, I am new here and have found many answers to my problems from this website so I figured it was time to join. Here's the deal: I have just started trying to learn Python through MIT's OpenCourseWare. I am currently on PS1a (Problem set 1a) and am having … | |
As I've learned more about basic console Python script writing, I've had a look at both Tkinter and GTK+...and, at first glance, I like GTK+ better. Which do you guys prefer, and why? | |
| Hi, I have a quick, and what seems like very stupid question. I have a list of files in a directory with various extensions. I want to open only the ones with the extension '.txt'. I have got as far as finding them (and can print their filenames to a … |
hi guys !!! i want to make an web browser in python , as my college project . what i'm looking for is guidance , on how to make it and which module's shall i use . currently i'm planning to use webkit and gtk+ to obtain my goal. secondly … | |
Hi. if I want to use the for loop to make multiplication table for the number 3 in sequence. For ex; when I excute the for loop, I want the user to enter intger "3" and then it start to question 3x3, to the user and up if they did … | |
Hi everyone I am learning python, I came across a sample program which checks whether the given number is prime number or is not a prime number using **for loop** and **range()** function. I can't understand that program, can someone please help me understand it? Here is the program and … | |
Using the PySide GUI toolkit will make selecting, copying and pasting encrypted and decrypted text somewhat easier. Not ideal yet, but it will be a good start for those of you who are not very familiar with GUI programming. | |
I am trying to make a save feature in a game so that a player could save, then quit the game, then open the window again to select proflie and play from when they left off. Thanks!! |
The End.