“Pandas DataFrame” Kode Jawaban

Creator Daframe Python

d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
df
Awful Alpaca

PD.DataFram

data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)],
...                 dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")])
>>> df3 = pd.DataFrame(data, columns=['c', 'a'])
...
>>> df3
   c  a
0  3  1
1  6  4
2  9  7
it's_flat

Buat Python DataFrame

import numpy as np
import pandas as pd
vect1=np.zeros(10)
vect2=np.ones(10)
df=pd.DataFrame({'col1':vect1,'col2':vect2})
Tremendous Enceladus

Pandas DataFrame

>>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
...                    columns=['a', 'b', 'c'])
>>> df2
   a  b  c
0  1  2  3
1  4  5  6
2  7  8  9
Difficult Dunlin

Pandas DataFrame

d = {'col1': [1, 2], 'col2': [3, 4]}
>>> df = pd.DataFrame(data=d)
>>> df
   col1  col2
0     1     3
1     2     4
Nutty Newt

Pandas DataFrame

import pandas as pd

data = {
	"calories" : [420, 380, 390],
    "duration" : [50, 40, 45]
}

df = pd.DataFrame(data)
print(df)
Astra Logical

Jawaban yang mirip dengan “Pandas DataFrame”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya