By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
SmartData Collective
  • Analytics
    AnalyticsShow More
    predictive analytics in dropshipping
    Predictive Analytics Helps New Dropshipping Businesses Thrive
    12 Min Read
    data-driven approach in healthcare
    The Importance of Data-Driven Approaches to Improving Healthcare in Rural Areas
    6 Min Read
    analytics for tax compliance
    Analytics Changes the Calculus of Business Tax Compliance
    8 Min Read
    big data analytics in gaming
    The Role of Big Data Analytics in Gaming
    10 Min Read
    analyst,women,looking,at,kpi,data,on,computer,screen
    Promising Benefits of Predictive Analytics in Asset Management
    11 Min Read
  • Big Data
  • BI
  • Exclusive
  • IT
  • Marketing
  • Software
Search
© 2008-23 SmartData Collective. All Rights Reserved.
Reading: Python Programs for Non-Python People
Share
Notification Show More
Latest News
ai digital marketing tools
Top Five AI-Driven Digital Marketing Tools in 2023
Artificial Intelligence
ai-generated content
Is AI-Generated Content a Net Positive for Businesses?
Artificial Intelligence
predictive analytics in dropshipping
Predictive Analytics Helps New Dropshipping Businesses Thrive
Predictive Analytics
cloud data security in 2023
Top Tools for Your Cloud Data Security Stack in 2023
Cloud Computing
become a data scientist
Boosting Your Chances for Landing a Job as a Data Scientist
Jobs
Aa
SmartData Collective
Aa
Search
  • About
  • Help
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
SmartData Collective > Uncategorized > Python Programs for Non-Python People
Uncategorized

Python Programs for Non-Python People

Editor SDC
Last updated: 2010/02/04 at 7:47 PM
Editor SDC
5 Min Read
SHARE

Python programs written to run in BEGIN PROGRAM blocks are easy to write and add lots of functionality to IBM SPSS Statistics.  Many users have learned to create these. More users, though, do not know the Python language.

The extension command mechanism provides a way for users of traditional SPSS syntax to run Python programs written by someone else without needing any knowledge of Python.  But the program must have been written as an extension command.  While creating extension commands isn’t hard, it does require some extra knowledge and work.  (An article on how to do this is available on Developer Central.)

I have posted a new extension command, SPSSINC PROGRAM, that allows ordinary Python programs to be run with traditional syntax without the author having created an extension command: easy on the author and easy on the user.

Often someone writes and shares a Python program for use via BEGIN PROGRAM that requires some input parameters.  The BEGIN PROGRAM syntax does not allow for parameters, so the user must modify the program itself to specify these.  If you know Python, this is not a problem, but many users are uncomfortable doing that, since the Python language is …

More Read

machine learning in accounting

New Open-Source Tools Use Machine Learning to Streamline Content Writing Process

How To Manage OpenShift Secrets With Akeyless Vault
How Well Do You Know Open Source Projects? Take Our Quiz
Revolution Analytics CEO: Big Data Is a New Management Discipline
Open Source on an upward trend

Python programs written to run in BEGIN PROGRAM blocks are easy to write and add lots of functionality to IBM SPSS Statistics.  Many users have learned to create these. More users, though, do not know the Python language.

The extension command mechanism provides a way for users of traditional SPSS syntax to run Python programs written by someone else without needing any knowledge of Python.  But the program must have been written as an extension command.  While creating extension commands isn’t hard, it does require some extra knowledge and work.  (An article on how to do this is available on Developer Central.)

I have posted a new extension command, SPSSINC PROGRAM, that allows ordinary Python programs to be run with traditional syntax without the author having created an extension command: easy on the author and easy on the user.

Often someone writes and shares a Python program for use via BEGIN PROGRAM that requires some input parameters.  The BEGIN PROGRAM syntax does not allow for parameters, so the user must modify the program itself to specify these.  If you know Python, this is not a problem, but many users are uncomfortable doing that, since the Python language is quite different from the traditional SPSS language.

A Python programmer would typically define a function or class with the requisite parameters and just modify the function call.  An SPSS user might not know how to do that.

SPSSINC PROGRAM solves this problem.  (Of course, extension commands solve this problem more generally, but they take extra work to create.)   Suppose I have a program saved as mymodule.mypgm.py that does something to a pair of  SPSS variables , and I want the variable names to be  parameters.  Using SPSSINC PROGRAM, I would write

SPSSINC PROGRAM mymodule.mypgm firstvar secondvar.

firstvar and secondvar would be the parameter values passed to the program.  SPSSINC PROGRAM ensures that mymodule.mypgm is called,  makes the parameters available to the program, and handles various error conditions.

Instead of passing the parameters as function arguments, the parameters are set up as if they were a command line.  The author of the program would access these in the traditional Python way via sys.argv, with the first parameter being the module and program name.  It’s just as if the program were being run from a command shell, except that the parameter values have been passed through the SPSS Universal Parser.  Comments in the implementation module details the (small) differences this can produce in what the program sees.

So using SPSSINC PROGRAM is very easy on the Python programmer while still letting the user of the program work in the style he or she is comfortable with.  The package also includes a dialog box built with the Custom Dialog Builder where the user can enter the program name and any parameters.

TAGGED: open source
Editor SDC February 4, 2010
Share this Article
Facebook Twitter Pinterest LinkedIn
Share

Follow us on Facebook

Latest News

ai digital marketing tools
Top Five AI-Driven Digital Marketing Tools in 2023
Artificial Intelligence
ai-generated content
Is AI-Generated Content a Net Positive for Businesses?
Artificial Intelligence
predictive analytics in dropshipping
Predictive Analytics Helps New Dropshipping Businesses Thrive
Predictive Analytics
cloud data security in 2023
Top Tools for Your Cloud Data Security Stack in 2023
Cloud Computing

Stay Connected

1.2k Followers Like
33.7k Followers Follow
222 Followers Pin

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

[mc4wp_form id=”1616″]

You Might also Like

machine learning in accounting
Machine Learning

New Open-Source Tools Use Machine Learning to Streamline Content Writing Process

5 Min Read
openshift secrets
IT

How To Manage OpenShift Secrets With Akeyless Vault

11 Min Read

How Well Do You Know Open Source Projects? Take Our Quiz

1 Min Read
analytics
AnalyticsBig DataPredictive AnalyticsR Programming LanguageStatistics

Revolution Analytics CEO: Big Data Is a New Management Discipline

8 Min Read

SmartData Collective is one of the largest & trusted community covering technical content about Big Data, BI, Cloud, Analytics, Artificial Intelligence, IoT & more.

AI and chatbots
Chatbots and SEO: How Can Chatbots Improve Your SEO Ranking?
Artificial Intelligence Chatbots Exclusive
ai in ecommerce
Artificial Intelligence for eCommerce: A Closer Look
Artificial Intelligence

Quick Link

  • About
  • Contact
  • Privacy
Follow US

© 2008-23 SmartData Collective. All Rights Reserved.

Removed from reading list

Undo
Go to mobile version
Welcome Back!

Sign in to your account

Lost your password?