Unnamed: 0 int64 0 15.9k | cleaned_code stringlengths 67 124k ⌀ | cleaned_prompt stringlengths 168 30.3k ⌀ |
|---|---|---|
0 | <ASSISTANT_TASK:>
Python Code:
short_freq = (hdulist[0].header['STEPSIZE'] / (60. * 60. * 24.))
med_freq = (10. / (60. * 24.))
long_freq = 1. / 24.
max_freq = 10. / 24.
from scipy.signal import lombscargle
short_periods = np.linspace(short_freq, med_freq, len(times))
med_periods = np.linspace(med_freq, long_freq, len(... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Lomb-Scargle Periodogram via scipy
Step2: Lomb-Scargle Periodogram via astroML
Step3: Try with more data!
Step4: Try with noisy data
Step5: ... |
1 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
def checkerboard(size):
Return a 2d checkboard of 0.0 and 1.0 as a NumPy array
check = np.zeros((size,size),float)
check.... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Checkerboard
Step3: Use vizarray to visualize a checkerboard of size=20 with a block size of 10px.
Step4: Use vizarray to visualize a checkerb... |
2 | <ASSISTANT_TASK:>
Python Code:
%pylab inline
import sys
from corner import corner
sys.path.append('.')
from src.mocklc import MockLC, SimulationSetup
from src.blendlpf import MockLPF
import src.plotting as pl
lc = MockLC(SimulationSetup('M', 0.1, 0.0, 0.0, 'short_transit', cteff=5500, know_orbit=True))
lc.create(wnsi... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Create a mock light curve
Step2: Initialize the log posterior function
Step3: Optimize
Step4: Estimate the posterior
Step5: Analysis
Step6: ... |
3 | <ASSISTANT_TASK:>
Python Code:
df1 = pd.read_csv('listings/30042015/30042015.csv', sep = ";")
df2 = pd.read_csv('listings/17072015/17072015.csv', sep = ";")
df3 = pd.read_csv('listings/02102015/02102015.csv', sep = ";")
df4 = pd.read_csv('listings/03012016/03012016.csv', sep = ";")
df5 = pd.read_csv('listings/08122016/... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: feim un DataFrame on cada columna conté els host_id de cada scrap i de nom li posam la data de l'scrap
Step2: Feim un dataframe amb l'índex del... |
4 | <ASSISTANT_TASK:>
Python Code:
!conda install -y netcdf4
from netCDF4 import Dataset, num2date, date2num
from numpy import *
import matplotlib.pyplot as plt
%matplotlib inline
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
x = linspace(0, 1, 100) # generates a hundred values between... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Add to the function to allow amplitude to be varied and aadd in an additional slider to vary both f and a
Step2: Climate data
Step3: Plotting ... |
5 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import numexpr as ne
ne.set_num_threads(10);
rho = np.empty((512,512,512), dtype=np.float32)
rho[:] = np.random.random(rho.shape)
rho_mean = rho.mean(dtype=np.float64).astype(np.float32) # Use double precision for intermediate accumulations
%%timeit
delta = np.exp((rh... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: The NumPy way
Step2: The Numexpr way
Step3: We were using 10 cores. Did our speedup come from multi-threading or loop-blocking/vectorization?... |
6 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 18})
import tqdm
import numpy as np
import espressomd.observables
import espressomd.accumulators
espressomd.assert_features(
["ENGINE", "ROTATION", "MASS", "ROTATIONAL_INERTIA", "CUDA"])
ED_PARAMS = {... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Exercise
Step2: No more setup needed! We can run the simulation and plot our observables.
Step4: The Mean Square Displacement of an active par... |
7 | <ASSISTANT_TASK:>
Python Code:
import xarray as xr
import numpy as np
import os, sys
import matplotlib.pyplot as plt
import cartopy
import cartopy.crs as ccrs
%matplotlib inline
def read_data(file_name):
Read netcdf file and return variables:
rlat, rlon, var, px and py.
# read the dataset
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Allow to display the output of plotting commands in notebook
Step3: Function read_data
Step5: Function main
Step6: Run main
|
8 | <ASSISTANT_TASK:>
Python Code:
df
df=pd.read_csv(csv_path)
df[(df[u'year'] <= 2016)]
print pd.Timestamp.min
print pd.Timestamp.max
year2=[]
for i in df['year']:
try: year2.append(int(i[6:10]))
except: year2.append(np.nan)
df['year']=year2
df[(df[u'year'] <= 2016)]
df = df[(df[u'reclat'] != 0.0) & (df[u'rec... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: lassuk lepesekben
Step2: ugy nez ki ez a kifejezes a hibas a 2016-al. ez a zert van, mert ez az oszlop nem valos datumkent van ertelmezve. ket ... |
9 | <ASSISTANT_TASK:>
Python Code:
from sklearn.datasets import make_regression
from sklearn.cross_validation import train_test_split
X, y, true_coefficient = make_regression(n_samples=80, n_features=30, n_informative=10, noise=100, coef=True, random_state=5)
X_train, X_test, y_train, y_test = train_test_split(X, y, random... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Linear Regression
Step2: Ridge Regression (L2 penalty)
Step3: Lasso (L1 penalty)
Step4: Linear models for classification
Step5: Multi-Class ... |
10 | <ASSISTANT_TASK:>
Python Code:
# conda install ipyrad -c bioconda
# conda install toytree -c eaton-lab
import pandas as pd
import toytree
# load the tree table from CSV
tree_table = pd.read_csv(
"./analysis-treeslider/test.tree_table.csv",
index_col=0,
)
# examine top of table
tree_table.head()
outfile = open... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Short Tutorial
Step2: Write the trees column to a file
Step3: Get Astral
Step4: Run Astral
Step5: Plot astral species tree
|
11 | <ASSISTANT_TASK:>
Python Code:
%pylab inline
from sg2lib import *
gamma = 1
Sx = 2
Fs = array([[1, gamma], [0, 1]])
Fp = array([[Sx, 0], [0, 1/Sx]])
n = 10
Fsi = array([[1, gamma/n], [0, 1]])
print('Incremental deformation gradient:')
print(Fsi)
array_equal(matrix_power(Fsi, n), Fs)
Fpi = array([[Sx**(1/n), 0], [0, ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Naive concept of simultaneous deformation
Step2: To divide simple shear deformation with $\gamma$=1 to n incremental steps
Step3: To check tha... |
12 | <ASSISTANT_TASK:>
Python Code:
import os
import mne
from mne.preprocessing import (ICA, create_eog_epochs, create_ecg_epochs,
corrmap)
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: <div class="alert alert-info"><h4>Note</h4><p>Before applying ICA (or any artifact repair strategy), be sure to observe
Step2: We can get a sum... |
13 | <ASSISTANT_TASK:>
Python Code:
# import variable setting dictionaries from dkrz data ingest tool chain
# and remove __doc__ strings from dictionary (would clutter PROV graph visualizations)
from provtemplates import workflow_steps
from collections import MutableMapping
from contextlib import suppress
def delete_keys_fr... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Template representation variant 1
Step2: Template representation variant 2
Step3: Template representation variant 3
|
14 | <ASSISTANT_TASK:>
Python Code:
training = sqlContext.read.parquet("s3://zoltanctoth-flights/training.parquet")
test = sqlContext.read.parquet("s3://zoltanctoth-flights/training.parquet")
test.printSchema()
test.first()
training.cache()
test.cache()
from pyspark.sql.types import DoubleType
from pyspark.sql.functions im... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Generate label column for the training data
Step2: Create and fit Spark ML model
Step3: Predict whether the aircraft will be late
Step4: Chec... |
15 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib
matplotlib.rcParams['figure.figsize'] = (10.0, 8.0)
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d, InterpolatedUnivariateSpline
from scipy.optimize import bisect
import json
from functools import partial
clas... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: And some more specialized dependencies
Step2: Configuration for this figure.
Step3: Open a chest located on a remote globus endpoint and load ... |
16 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
def find_peaks(a):
Find the indices of the local maxima in a sequence.
# YOUR CODE HERE
#raise NotImplementedError()
ind=[]
#next two if checks end points
if a[0]> a[1... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Peak finding
Step3: Here is a string with the first 10000 digits of $\pi$ (after the decimal). Write code to perform the following
|
17 | <ASSISTANT_TASK:>
Python Code:
def g(x, alpha, beta):
assert alpha >= 0 and beta >= 0
return (alpha*x)/(1 + (beta * x))
def plot_cobg(x, alpha, beta):
y = np.linspace(x[0],x[1],300)
g_y = g(y, alpha, beta)
cobweb(lambda x: g(x, alpha, beta), y, g_y)
# configura gráfica interactiva
interact(plot_co... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Búsqueda algebráica de puntos fijos
Step2: Punto fijo oscilatorio
Step3: ¿Qué pasará con infinitas iteraciones?
|
18 | <ASSISTANT_TASK:>
Python Code:
import os
import sys
root_folder = os.path.dirname(os.getcwd())
sys.path.append(root_folder)
import ResoFit
from ResoFit.calibration import Calibration
from ResoFit.fitresonance import FitResonance
from ResoFit.experiment import Experiment
from ResoFit._utilities import Layer
import numpy... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Global paramters
Step2: File locations
Step3: Preview data using Experiment()
Step4: Data
Step5: Spectra
Step6: Remove unwanted data points... |
19 | <ASSISTANT_TASK:>
Python Code:
#Like before, we're going to select the relevant columns from the database:
connection = psycopg2.connect('dbname= threeoneone user=threeoneoneadmin password=threeoneoneadmin')
cursor = connection.cursor()
cursor.execute('''SELECT createddate, closeddate, borough FROM service;''')
data = ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Let's extract years and months again
Step2: And now, we're going to filter out bad cases again. However, this time, we're going to be a bit mor... |
20 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns; sns.set() # for plot styling
import numpy as np
import threading
import time
from sklearn.datasets.samples_generator import make_blobs
from sklearn.cluster import KMeans
import sys
sys.path.append("../")
from IoTPy... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Part 1
Step2: Sklearn function to generate random points
Step3: Function to compute kmeans and plot clusters.
Step4: Function to change the p... |
21 | <ASSISTANT_TASK:>
Python Code:
# Importando Bibliotecas
import csv
import matplotlib.pyplot as plt
from math import sqrt
from random import randrange
# Definição da função que transforma um conjunto de dados inteiro em float
def str_column_to_float(data):
newData = []
for lines in data:
aux = [float(x) ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Utilização da Regressão Linear e Avaliação do Algoritmo
Step2: Visualização da Regressão Linear
|
22 | <ASSISTANT_TASK:>
Python Code:
!rm -rf hello setup.py && mkdir hello
%%file hello/hello.py
#pythran export hello()
def hello():
Wave hello.
print("Hello from Pythran o/")
%%file hello/__init__.py
Hello package, featuring a Pythran kernel.
from hello import hello
%%file setup.py
from distutils.core ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Project layout
Step4: And so is the __init__.py file.
Step5: The setup.py file contains the classical metadata, plus a special header. this he... |
23 | <ASSISTANT_TASK:>
Python Code:
from pylab import *
t = arange(0.0, 2.0,0.01)
y = sin(2*pi*t)
plot(t, y)
xlabel('Time (s)')
ylabel('Voltage (mV)')
title('The simplest one, buddies')
grid(True)
show()
from pylab import *
t = arange(0.0, 2.0,0.01)
y = sin(2*pi*t)
plot(t, y, color='red')
xlabel('Time (s)')
ylabe... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Custom plot line
Step2: A custom 2D plot, based on our first example.
|
24 | <ASSISTANT_TASK:>
Python Code:
#Example conditional statements
x = 1
y = 2
x<y #x is less than y
#x is greater than y
x>y
#x is less-than or equal to y
x<=y
#x is greater-than or equal to y
x>=y
#Example of and operator
(1<2)and(2<3)
#Example of or operator
(1<2)or(2>3)
#Example of not operator
not(1>2)
x = 1
y = 2
i... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: If you let a and b be conditional statements (like the above statements, e.g. a = x < y), then you can combine the two together using logical op... |
25 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
a = np.array([[ 0, 1, 2, 3, 4, 5],
[ 5, 6, 7, 8, 9, 10],
[10, 11, 12, 13, 14, 15],
[15, 16, 17, 18, 19, 20],
[20, 21, 22, 23, 24, 25]])
result = np.diag(np.fliplr(a))
<END_TASK> | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
|
26 | <ASSISTANT_TASK:>
Python Code:
# загрузка из файла
reviews_test = pd.read_csv('data/reviews_test.csv', header=0, encoding='utf-8')
reviews_train = pd.read_csv('data/reviews_train.csv', header=0, encoding='utf-8')
reviews_internet = pd.read_csv('data/internet_reviews.csv', header=0, encoding='utf-8')
# обучающая выборка... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Загрузка обработчика комментариев
Step2: Обработка данных
Step3: Обучение модели
Step4: Результаты
Step5: Классификатор 5 / не 5
Step6: Cни... |
27 | <ASSISTANT_TASK:>
Python Code:
# Python
// JavaScript
# No output
# Plain text output
"Hello world"
True
False
42
import math
math.pi
dict(a=1,b=2)
list(range(10))
dict(a='string', b=1, c=3.14, d=[1, 2, 3], e=dict(f=1))
# Stream output
print("Just a string")
# Matplotlib
import matplotlib.pyplot as plt
import numpy ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: The following code cells illustrate how different types of cell outputs are decoded.
Step2: Primitive outputs
Step3: Image outputs
Step4: HTM... |
28 | <ASSISTANT_TASK:>
Python Code:
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
%pylab inline
from distutils.version import StrictVersion
import sklearn
print(sklearn.__version__)
assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1')
import tensorflow as tf
tf.logging.set_verbosity(t... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: How does Tensorflow Low Level API look like?
Step2: Interactive usage of Low Level API
Step3: Calling a TensorFlow Model deployed on Google Cl... |
29 | <ASSISTANT_TASK:>
Python Code:
import matplotlib.pyplot
# We have this here to trigger matplotlib's font cache stuff.
# This cell is hidden from the output
import pandas as pd
import numpy as np
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Here's a boring example of rendering a DataFrame, without any (visible) styles
Step2: Note
Step4: The row0_col2 is the identifier for that par... |
30 | <ASSISTANT_TASK:>
Python Code:
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
raw_fname = data_path + '/MEG... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Set parameters
Step2: Show event related fields images
|
31 | <ASSISTANT_TASK:>
Python Code:
#export
from exp.nb_01 import *
def get_data():
path = datasets.download_data(MNIST_URL, ext='.gz')
with gzip.open(path, 'rb') as f:
((x_train, y_train), (x_valid, y_valid), _) = pickle.load(f, encoding='latin-1')
return map(tensor, (x_train,y_train,x_valid,y_valid))
d... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Foundations version
Step2: Tinker practice
Step3: From pytorch docs
Step4: Loss function
Step5: We need squeeze() to get rid of that trailin... |
32 | <ASSISTANT_TASK:>
Python Code:
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
# sphinx_gallery_thumbnail_number = 9
data_path = mne.datasets.sample.data_path()
fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif')
evoked = mne.read_evokeds(fname, baseline=(None, 0), p... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: First we read the evoked object from a file. Check out
Step2: Notice that evoked is a list of
Step3: Let's start with a simple one. We plot e... |
33 | <ASSISTANT_TASK:>
Python Code:
# run this cell first!
fruits = {"apple":"red", "banana":"yellow", "grape":"purple"}
print fruits["banana"]
query = "apple"
print fruits[query]
print fruits[0]
print fruits.keys()
print fruits.values()
for key in fruits:
print fruits[key]
del fruits["banana"]
print fruits
print fruit... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: There's no concept of "first element" in a dictionary, since it's unordered. (Of course, if you happened to have a key in your dictionary that w... |
34 | <ASSISTANT_TASK:>
Python Code:
# download sample files
!wget -P data -nc ftp://ftp.nersc.no/nansat/test_data/obpg_l2/A2015121113500.L2_LAC.NorthNorwegianSeas.hdf
!wget -P data -nc ftp://ftp.nersc.no/nansat/test_data/obpg_l2/A2015122122000.L2_LAC.NorthNorwegianSeas.hdf
import numpy as np
import matplotlib.pyplot as plt
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Open MODIS/Aqua files with chlorophyll in the North Sea and fetch data
Step2: Plot chlorophyll-a maps in swath projection
Step3: Colocate data... |
35 | <ASSISTANT_TASK:>
Python Code:
import itertools
# heads = True
# tails = False
# Initialize coins to all heads
coins = [True]*100
for factor in range(100):
# This will generate N zeros, then a 1. This repeats forever
flip_generator = itertools.cycle([0]*factor+[1])
# This will take the first 100 items... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Classic Riddler
Step2: If I would not have seen this particular tweet (https
|
36 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
df= pd.read_excel("NHL 2014-15.xls")
!pip install xlrd
df.columns.value_counts()
df.head()
df.columns
df['Ctry'].value_counts().head(10)
df['Nat'].value_counts().head(10)
df['Birth City'].value_counts().head(1... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Here's all of our data
Step2: Here are each of the columns in the data set
Step3: Let's count how many players are from each country
Step4: L... |
37 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
import numpy as np
x = np.linspace(0, 10, 50)
dy = 0.8
y = np.sin(x) + dy * np.random.randn(50)
# yerr表示y的误差
plt.errorbar(x, y, yerr=dy, fmt='.k');
plt.errorbar(x, y, yerr=dy, fmt='o', color='black',
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 这里的fmt是控制线和点外观的格式代码,并且具有与plt.plot中使用的简写相同的语法,在Simple Line Plots和Simple Scatter Plots中进行了概述。
Step2: 除了这些选项之外,还可以指定水平误差线(xerr),单面误差线和许多其他变体。有关可用选... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 32