15,175 Topics

Member Avatar for
Member Avatar for Taruna_1

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 …

0
113
Member Avatar for mohan.jce

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 …

Member Avatar for james.lu.75491856
0
240
Member Avatar for nutrion

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 …

Member Avatar for nutrion
0
194
Member Avatar for Rebecca_2

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 …

Member Avatar for snippsat
0
284
Member Avatar for Rebecca_2

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, …

Member Avatar for Gribouillis
0
673
Member Avatar for ZBatool

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 …

0
104
Member Avatar for dabasank

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.

Member Avatar for vegaseat
0
134
Member Avatar for plasticfood

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 …

Member Avatar for plasticfood
0
359
Member Avatar for marethamogale

write a program that stimulates flipping a coin 100 times and then displays the total number of heads and total number of tails achieved

Member Avatar for phorce
0
174
Member Avatar for Joseph Vann

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 …

Member Avatar for ZZucker
0
397
Member Avatar for vlady2911

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 …

Member Avatar for glez_b
0
149
Member Avatar for Meikell 'Kai'

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 …

Member Avatar for Meikell 'Kai'
0
2K
Member Avatar for Gribouillis

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 :)

Member Avatar for Gribouillis
3
3K
Member Avatar for RHNation

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 = …

Member Avatar for vegaseat
0
8K
Member Avatar for ggsr45

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'} …

Member Avatar for ggsr45
0
178
Member Avatar for lucpet

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 * >>> …

Member Avatar for lucpet
0
212
Member Avatar for chris99
Member Avatar for farmwife
0
6K
Member Avatar for Ankurjain123

hi to all i want to use c program in python or in other way i want to run c program from python

Member Avatar for vegaseat
0
357
Member Avatar for RHNation

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) …

Member Avatar for farmwife
0
300
Member Avatar for onalenna.bobeilwe

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

Member Avatar for farmwife
0
231
Member Avatar for farmwife

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?

Member Avatar for farmwife
0
7K
Member Avatar for giancan

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 …

Member Avatar for giancan
0
344
Member Avatar for Dunkler

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 …

Member Avatar for Ashley_4
0
208
Member Avatar for farmwife

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?

Member Avatar for farmwife
0
4K
Member Avatar for Rebecca_2

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 …

Member Avatar for vegaseat
0
226
Member Avatar for thecreator232

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 …

Member Avatar for slate
0
462
Member Avatar for amrX

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 …

0
51
Member Avatar for Varunkrishna

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 …

Member Avatar for lucpet
0
936
Member Avatar for vegaseat

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.

Member Avatar for Lardmeister
2
525
Member Avatar for Jacklittle01

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!!

Member Avatar for james.lu.75491856
0
416

The End.