Making an arrey of a zipped list, Python

  • Context: Python 
  • Thread starter Thread starter MaxManus
  • Start date Start date
  • Tags Tags
    List Python
Click For Summary
SUMMARY

This discussion focuses on creating an array from a zipped list in Python. The user initially confuses Python lists with arrays, prompting clarification on the distinction. The provided code utilizes the SciPy library to import necessary functions and demonstrates how to generate a list of values using the normal distribution formula. The final output formats the zipped values of the xarray and harrey lists for display.

PREREQUISITES
  • Understanding of Python programming language
  • Familiarity with the SciPy library for mathematical functions
  • Knowledge of list and array data structures in Python
  • Basic concepts of the normal distribution and its mathematical representation
NEXT STEPS
  • Learn about Python list comprehensions for more efficient list manipulation
  • Explore the NumPy library for advanced array operations
  • Study the use of the SciPy library for statistical functions and distributions
  • Investigate the differences between Python lists and NumPy arrays
USEFUL FOR

Python developers, data scientists, and anyone interested in statistical data visualization using Python.

MaxManus
Messages
268
Reaction score
1
How do you make an arrey out of this list?

for X, H in zip(xarrey,harrey):
print "%.2f %.5f" % (X,H)
 
Technology news on Phys.org
Can you give me a more detailed explanation? I don't know what list you're talking about, or what you mean by "making an array" out it. Python doesn't have "arrays," it has lists.

- Warren
 
from scitools.all import *

def h(x):
return (1/(sqrt(2*pi)))*e**-(0.5*x**2)

xarray = linspace(-4,4,10)
x = xarray
harrey = zeros(len(xarrey))

for i in xrange(len(xarray)):
harrey = h(x)

for X, H in zip(xarray,harray):
print "%.2f %.5f" % (X,H)
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
6
Views
3K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 43 ·
2
Replies
43
Views
5K