标签:.com form bool dimens property lse mon cut nta
pandas.
DataFrame
(data=None, index=None, columns=None, dtype=None, copy=False)[source]Two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. Can be thought of as a dict-like container for Series objects. The primary pandas data structure
Parameters: |
data : numpy ndarray (structured or homogeneous), dict, or DataFrame
index : Index or array-like
columns : Index or array-like
dtype : dtype, default None
copy : boolean, default False
|
---|
See also
DataFrame.from_records
DataFrame.from_dict
DataFrame.from_items
pandas.read_csv
, pandas.read_table
, pandas.read_clipboard
1. 先来个小菜
基于dictionary创建
from pandas import Series, DataFrame import pandas as pd import numpy as np d = {‘col1‘:[1,2],‘col2‘:[3,4]} df = pd.DataFrame(data=d) print(df) print(df.dtypes) # col1 col2 #0 1 3 #1 2 4 #col1 int64 #col2 int64 #dtype: object
基于Numy的ndarrary
df2 = pd.DataFrame(np.random.randint(low=0, high=10, size=(5, 5)),columns=[‘a‘, ‘b‘, ‘c‘, ‘d‘, ‘e‘]) print (df2) # a b c d e #0 0 2 4 7 0 #1 6 7 3 4 1 #2 5 3 3 8 7 #3 0 9 4 3 4 #4 7 4 7 0 0
标签:.com form bool dimens property lse mon cut nta
原文地址:https://www.cnblogs.com/Jesse-Li/p/8808225.html