★ Must-know
Python is a programming language developed since 1989 whose simple syntax is based on indentation rather than symbols.
This course focuses on two Python applications in physics and chemistry: importing data and representing data graphically.
Further detail
★ Must-know
Further detail
Before importing a file, the user must identify the number of lines to ignore, including possible column headings or units, and the columns to import.
The example data file is named donnees.txt and contains measurements arranged in columns such as t, x, and y, with units shown in a separate line.
★ Must-know
📌 The skiprows parameter specifies the number of lines to skip when importing the file.
Further detail
The dtype parameter specifies the chosen data type for imported values.
The loadtxt parameters comments, converters, unpack, and encoding respectively identify comment-starting characters, convert character strings into numbers, return data in separate columns when set to True, and specify the file encoding.
★ Must-know
A basic graphing program imports NumPy and matplotlib.pyplot, loads x and y data with numpy.loadtxt(), plots the data, adds labels, and displays the graph.
The axis() function sets the graph axes, title() adds a graph title, and xlabel() and ylabel() label the horizontal and vertical axes.
Further detail
The legend() function displays the graph legend and show() displays the graphs on screen.
In the example, plt.plot(x, y, 'o-', color="red", marker="o", linewidth=1, label="vitesse") creates a red point-and-line plot labelled vitesse.
★ Must-know
The plot() function places points or connects abscissas and ordinates from the x and y lists, and its color, label, and marker parameters customize the display.
The quiver() function draws vectors using the origin coordinates x and y, the vector components, and additional display parameters.
The completed matplotlib graph represents the trajectory of a falling ball and includes several velocity vectors.
Further detail
Pon a prueba tus conocimientos sobre Python Data Import and Plotting con 14 preguntas de opción múltiple con correcciones detalladas.
1. What structural feature does Python use to define blocks of code?
2. Which pair of applications is emphasized for Python in physics and chemistry?
Memoriza los conceptos clave de Python Data Import and Plotting con 36 tarjetas de memoria interactivas.
What is the basis of Python's simple syntax?
Indentation rather than symbols.
Since when has Python been developed?
Since 1989.
How can Python be used online?
With the Python laboratory.
Importa tu curso y la IA genera hojas, cuestionarios y tarjetas de memoria en 30 segundos.
Generador de hojas