Basics - How to read a CSV file in python (and plot it)

Описание к видео Basics - How to read a CSV file in python (and plot it)

The CSV file is read with the 'pandas' library. You can install it by following this link: https://pandas.pydata.org/pandas-docs....


----------- Code ---------

import pandas as pd
df = pd.read_csv('velocity_measurements.csv',header=None)
print(df.head())

t = df[0]
v = df[1]

make a plot
from matplotlib import pyplot as plt

fig, ax = plt.subplots(figsize=(10,7))
ax.plot(t,v,lw=4)
ax.set_xlabel('Time [s]',fontsize=14)
ax.set_ylabel('Velocity [$m/s$]',fontsize=14)
ax.set_title('Experiment 1',fontsize=14)

-----------------------

Keywords: text file , csv file , pandas , python , jupyter notebook , read file , plot , graphic , matplotlib , pyplot , scientific , data , science

Комментарии

Информация по комментариям в разработке