If shell is True, the specified command will be executed through the shell. This can be useful if you are using Python primarily for the enhanced control flow it offers over most... moreIf shell is True, the specified command will be executed through the shell. This can be useful if you are using Python primarily for the enhanced control flow it offers over most system shells and still want convenient access to other shell features such as shell pipes, filename wildcards, environment variable expansion, and expansion of ~ to a user’s home directory.However, on cygwin, output from bash isn't the same as from Python's subprocess, viz:Bash:
$ ls -ls ~rbarakx
total 0
0 drwxr-xr-x 1 Administrator None 0 Aug 21 17:54 bash
0 drwxr-xr-x 1 Administrator None 0 Jul 11 09:11 python
Python:
>>> subprocess.call(,shell=True)
RCS mecha.py print_unicode.py req.py requests_results.html selen.py
0
It looks as if subprocess.call is executing just ls.Can you suggest why?My Environment:Python: Python 2.7.3 (default, Dec 18 2012, 13:50:09) on cygwincygwin: CYGWIN_NT-6.1-WOW64 ... 1.7.22(0.268/5/3) ... i686 Cygwinwindows: Windows 7 Ultimate less
I am developing a application in python which gives job recommendation based on the resume uploaded. I am trying to tokenize resume before processing further. I want to tokenize... moreI am developing a application in python which gives job recommendation based on the resume uploaded. I am trying to tokenize resume before processing further. I want to tokenize group of words. For example Data Science is a keyword when i tokenize i will get data and science separately. How to overcome this situation. Is there any library which does these extraction in python?
I'm trying to write a small Python module which contain some mathematical functions. For example, it might contain a function like:
def quad(x, a, b, c):
return a*x**2 + b*x +... moreI'm trying to write a small Python module which contain some mathematical functions. For example, it might contain a function like:
def quad(x, a, b, c):
return a*x**2 + b*x + c
As you may notice it contains several parameters (viz. a, b, c) apart from the variable x. Now if I were to put this in a file and simply import it, the end user would have to always call the function with the parameters in addition to the variable. Because of this I was thinking of creating a class such as this:
class quad:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def eq(x):
return self.a*x**2 + self.b*x + self.c
Thus allowing the end user to use it as:
q = quad(p, q, r)
eq = q.eq
Is this the right way of doing things? I am terribly sorry about the title of the question, as I... less
I want to automate deploying OVA image on VSphere with python. I looked up at some packages viz. Pysphere, psphere but didn't find direct method to do so. is there any Library I'm... moreI want to automate deploying OVA image on VSphere with python. I looked up at some packages viz. Pysphere, psphere but didn't find direct method to do so. is there any Library I'm missing or is there any other way to deploy OVA/OVF files/templates on VSphere with Python. Pls help!!!
I need to write python scripts to automate time configuration of Virtual Machines running on a ESX/ESXi host. I don't know which api to use... I am able to find to python bindings... moreI need to write python scripts to automate time configuration of Virtual Machines running on a ESX/ESXi host. I don't know which api to use... I am able to find to python bindings for VMWare apis viz. PySphere and PyVmomi. Could anyone please explain what is the difference between them, which one should be used?
Coming from a programming background where you write code, test, deploy, run.. I'm trying to wrap my head around the concept of "training a model" or a "trained model" in data... moreComing from a programming background where you write code, test, deploy, run.. I'm trying to wrap my head around the concept of "training a model" or a "trained model" in data science, and deploying that trained model.
I'm not really concerned about the deployment environment, automation, etc.. I'm trying to understand the deployment unit.. a trained model. What does a trained model look like on a file system, what does it contain?
I understand the concept of training a model, and splitting a set of data into a training set and testing set, but lets say I have a notebook (python / jupyter) and I load in some data, split between training/testing data, and run an algorithm to "train" my model. What is my deliverable under the hood? While I'm training a model I'd think there'd be a certain amount of data being stored in memory.. so how does that become part of the trained model? It obviously can't contain all the data used for training; so for instance if I'm training a chatbot agent (retrieval-based),... less
I'm learning object oriented programing in a data science context.
I want to understand what good practice is in terms of writing methods within a class that relate to one... moreI'm learning object oriented programing in a data science context.
I want to understand what good practice is in terms of writing methods within a class that relate to one another.
When I run my code:
import pandas as pd
pd.options.mode.chained_assignment = None
class MyData:
def __init__(self, file_path):
self.file_path = file_path
def prepper_fun(self):
'''Reads in an excel sheet, gets rid of missing values and sets datatype to numerical'''
df = pd.read_excel(self.file_path)
df = df.dropna()
df = df.apply(pd.to_numeric)
self.df = df
return(df)
def quality_fun(self):
'''Checks if any value in any column is more than 10. If it is, the value is replaced with
a warning 'check the original data value'.'''
for col in self.df.columns:
for row in self.df.index:
if self.df > 10:
self.df = str('check original data value')
return(self.df)
I am trying to plot a simple function in python ( x + sqrt(x^2 + 2x) ). Here is my code:
import pylab as pl
import numpy as np
import... moreI am trying to plot a simple function in python ( x + sqrt(x^2 + 2x) ). Here is my code:
import pylab as pl
import numpy as np
import math
X = np.linspace(-999999,999999)
Y = (X+math.sqrt(X**2+2*X))
pl.plot(X,Y)
pl.show()
Here is the error that I am facing: TypeError: only length -1 arrays can be converted to Python scalars
I am trying to display a tree graph of my class hierarchy using networkx. I have it all graphed correctly, and it displays fine. But as a circular graph with crossing edges, it... moreI am trying to display a tree graph of my class hierarchy using networkx. I have it all graphed correctly, and it displays fine. But as a circular graph with crossing edges, it is a pure hierarchy, and it seems I ought to be able to display it as a tree.
I have googled this extensively, and every solution offered involves using pygraphviz... but" PyGraphviz does not work with Python 3 (documentation from the pygraphviz site)."
Has anyone been able to get a tree graph display in Python 3?
Please which Python IDE can someone recommend that meet these creteria: 1)New to programming-beginner 2)The IDE can be used for both web development and data science 3)Have... morePlease which Python IDE can someone recommend that meet these creteria: 1)New to programming-beginner 2)The IDE can be used for both web development and data science 3)Have inbuilt preview for web development,similar to ASP.net framework 4)open source
Link shows a graphic visualization taken form census website. Link for the same is shared below. I want to create graphic visualization of the same kind in my python program.
Link... moreLink shows a graphic visualization taken form census website. Link for the same is shared below. I want to create graphic visualization of the same kind in my python program.
Link for the graphic visualization: http://www.census.gov/dataviz/visualizations/stem/stem-html/
Which kind of visualization is this? is it a piechart or any other different kind of graphic visualization.
Are there any APIs available to create such a visualization or do i need to use any web service?
I am looking into pubnub to use in my real time data visualization with Rickshaw. But I do not understand are the channels already configured or do we have to configure them. If... moreI am looking into pubnub to use in my real time data visualization with Rickshaw. But I do not understand are the channels already configured or do we have to configure them. If so how can we configure a channel for a data viz? Also I am getting the data from python Ceilometer API how can I push that data into pubnub?
I have a data set with huge number of features, so analysing the correlation matrix has become very difficult. I want to plot a correlation matrix which we get using... moreI have a data set with huge number of features, so analysing the correlation matrix has become very difficult. I want to plot a correlation matrix which we get using dataframe.corr() function from pandas library. Is there any built-in function provided by the pandas library to plot this matrix?
So far I have been unable to find an R library that can create a sunburst plot like those by John Stasko. Anyone knows how to accomplish that in R or Python?