Questions about interfacing with, or features inspired or demonstrated by Python--a programming language featuring a dynamic type system, automatic memory management, and a comprehensive standard library.

learn more… | top users | synonyms

53
votes
3answers
3k views

Python-style plots in Mathematica

I love making plots in Mathematica. And I love to spend a lot of time making high-quality plots that maximize readability and aesthetics. For most cases, Mathematica can make very beautiful images, ...
37
votes
5answers
4k views

Is there a way to run Python from within Mathematica?

I know there is some support for running Mathematica from Python, but is there any way to do the reverse. For example, to import some Python classes and use them in Mathematica?
36
votes
5answers
12k views

How to use Mathematica functions in Python programs?

I'd like to know how can I call Mathematica functions from Python. I appreciate a example, for example, using the Mathematica function Prime. I had search about MathLink but how to use it in Python ...
25
votes
3answers
1k views

Calling IronPython code from Mathematica

I'd like to call some IronPython code from Mathematica using .NET/Link. The problem is that the code lives in .py files, yet from Mathematica I can only load .NET assemblies which are DLLs. So it ...
23
votes
2answers
831 views

Is there a built-in equivalent to Python's enumerate?

Python's built-in function enumerate takes an iterable over $(a_0, a_1, \dots )$ as argument and returns an iterable over the sequence of pairs $((0, a_0), (1, ...
18
votes
0answers
345 views

How does Dataset compare to DataFrame in pandas?

Pandas is a Python package providing fast, flexible, and expressive data structures designed to make working with “relational” or “labeled” data. Just like ...
16
votes
1answer
1k views

Numerical integration — Mathematica vs Python (w/ Scipy) performance

I'm about to tackle a problem that involves a lot of (multi-dimensional) numerical integrations and also subsequent optimizations, and so I want to make sure at least the integration step is as fast ...
13
votes
1answer
448 views

Any solution to transfer data between Python and Mathematica

I think Mathematica handles .mat file not very well, python is pretty good at this kind of jobs. In this site, there are plenty of question related to calling Mathematica from Python, or calling ...
12
votes
1answer
2k views

Mathematica vs Python - how does it compare to Python's scientific computing suite?

Python's family of packages for scientific computing has matured rapidly. I can pretty much replicate all of Mathematica's functionalities, but with production level and open-source code using the ...
10
votes
1answer
2k views

Output from Wolfram language in Python

I have a Python program which will run a script in the Wolfram language and then return to the main program. Is it possible to return values/variables to the main program? This is the code in Python ...
9
votes
1answer
448 views

How to get Python bindings to work on the Raspberry Pi

There are several examples on this site on how to call Mathematica from Python. You can: install the bindings that come with Mathematica; or call a script as a subprocess from within Python; or ...
8
votes
0answers
304 views

How to write markdown with Mathematica?

Usually I typeset with Latex and Compute with Mathematica and then copy the outputs as Latex code and insert them in Latex, so I have to switch between Latex and Mathematica frequently. Thanks to the ...
7
votes
2answers
599 views

How to create a function like in Python

I want to call a function that would perform a function rather than assigning an expression to them. I.e. ...
4
votes
1answer
1k views

Convert mathematica math expression form to python math expression?

I obtain a raw input form of: ...
4
votes
2answers
357 views

Pasting external PDF vector graphics without losing ability to export them

Update: Problem persists in version 10.2 on Mac OS X 10.9.5 As in previous versions, Mathematica 9 on Mac OS X (10.7.5 here) still has a problem with pasted PDF ...
4
votes
1answer
255 views

String encoding issue with Pythonika

I use Mathematica and Pythonika to run Python code inside it. And I'm not quite sure what causes my issue: all unicode Python objects look like this: ...
4
votes
1answer
213 views

What is the correct way to provide Mathematica with a path to Python user scripts?

What is the correct way to provide Mathematica with a path to Python user scripts? Simply executing Python as a shell command, using something like ...
4
votes
0answers
68 views

How to run a Mathematica package (.m) from python?

I am new to Mathematica and I need to interface with a Python code that I have. Basically, I have a Mathematica package (.m) with a bunch of complicated functions. I want to use some code from python ...
3
votes
2answers
271 views

Build mathlink.pyd for Python on windows using Mathematica 10

Evidently, the mathlink Python extension has not been updated for some time. As shown below, it doesn't link to the correct libraries. Also, the API seems to have been updated while the mathlink ...
3
votes
0answers
207 views

How to batch run Mathematica code from Python?

I have this notebook: ...
2
votes
1answer
318 views

Is there any function in Wolfram Mathematica simmilar to fft.fftfreq (Python)

Here is an explanation of fft.fftfreq I have data with random noise: ...
2
votes
0answers
50 views

why do python modules load differently via mathematica? [duplicate]

its a steep learning curve trying to integrate mathematica with python's modules/library. I am using a Rapberry pi 3 with mathematica's wolfram command line. I know little about both platforms (so ...
2
votes
1answer
208 views

Executing C programs within mathematica [duplicate]

I have a requirement for executing a C program within Mathematica. The user will provide the inputs and the expected results on a front end. Mathematica runs the C file, obtains the result for the ...
1
vote
4answers
1k views

Mathematica's equivalent to the Python's Zip command in List-comprehension? [closed]

What is Mathematica's equivalent to Python's ZIP command? Is this called nesting? It means iterating over sub-sets of values like the below example. How can I do it in Mathematica? Example in Python ...
1
vote
1answer
70 views

How to visualize .data files? [closed]

I am working with simulation models trying to carrying out some predictions in ocean waves and this stuff. (MITgcm) I am able to run the program and generate hundreds of .data and .meta files, but i ...
1
vote
1answer
643 views

Hex Representation in Mathematica and Python

I want to convert a code from Mathematica to Python. I am using the following code to convert a code to hexadecimal, binary and so on: ...
1
vote
2answers
97 views

What can I use as an equivalent of python zip in mathematica inside of Sum[]? [closed]

I want to take two lists of the same length: widths and weights, and sum a function (of 3 variables) over a single index using the elements from both lists that have that index. Then I want to plot ...
1
vote
1answer
226 views

What's wrong with my code for finding primes?

From here I found a fast method to make prime list, the python version works well, but my Mathematica version does not. Obviously ,169 is not a prime number. What's ...
1
vote
0answers
56 views

How to call python code on an image

I have lots of image processing code written in python and would like to call it from within mathematica. Is there a way to transmit the image data directly like with c++ and LibraryLink? I'd rather ...
1
vote
0answers
63 views

Issue with WSTP

I'm trying to get Pythonika to work once again - with the latest version of the WSTP. The changes required are not many, basically just three: Change ML to WS Change mprep to wsprep Change mcc to ...
1
vote
0answers
180 views

Mathematica and Python integration? [duplicate]

Possible Duplicate: Is there a way to run Python from within Mathematica? I do see the latest version has R-link: http://www.wolfram.co.uk/mathematica/new-in-9/built-in-integration-with-r/ ...
0
votes
1answer
92 views

Create an array with certain conditions and use it to fill a matrix [closed]

I am translating my code from Python to Mathematica. Here is a piece of my Python code: ...
0
votes
1answer
479 views

How to convert a Mathematica list in a Python list?

I was wondering if you know, how to save a Mathematica list (variable) such that it can be read later in Python. In order words, how to save a variable ...
0
votes
0answers
64 views
0
votes
0answers
30 views

Run mathematica script from python program [duplicate]

Is it possible to run the mathematica code inside the Python program? A simple pseudo-code to describe what I mean: ...
0
votes
0answers
187 views

FeynRules issue when trying to export UFO file

I am having problems with the UFO file generated by a very simple model using FeynRules. The following error occurs when MadGraph tries to import the "Model_UFO" file: ...
0
votes
0answers
70 views

How to get the Mathematica output in Python? [duplicate]

I'd like to call Mathematica function in Python. I do it as follows: How to use Mathematica functions in Python programs?. And I can call mathematic function in python and get the print output of ...
-2
votes
1answer
120 views

Recreating in Mathematica a matrix created in Python [closed]

I need to recreate in Mathematica this matrix that I created in Python: ...