[Python] What is pandas Series and DataFrame?

pandas Series, DataFrame

I started to get started with machine learning theory for IT engineers. I didn't know what the DataFrame meant, so I got stuck. It is the result of the investigation. By the way, Series

From the official documentation of the pandas 0.17.1 documentation

The two primary data structures of pandas, Series (1-dimensional) and DataFrame (2-dimensional), handle the vast majority of typical use cases in finance, statistics, social science, and many areas of engineering. For R users, DataFrame provides everything that R’s data.frame provides and much more.

Simple translation Pandas has two main data structures. ** Series is one-dimensional ** ** DataFrame is 2D ** These are used in various fields (finance, statistics ...) From the R user's point of view, DataFrame provides more than R's data.frame provides.

How to use

#Numerical library import
import numpy
#Import Series and DataFrame from data analysis library
from pandas import Series, DataFrame

#Series
#data dummy argument:data. array-like, dict, or scalar value
#index dummy argument:Subscript of data. array-like or Index (1d)
#dtype dummy argument:data type. numpy.dtype or None
#copy dummy argument:copy. Default is false
#name formal argument:Name given to the result
#1
print(Series(data=[0,1]))
#2
print(Series(data=[2,3], index=['x', 'y'], name='value'))

#DataFrame
#data dummy argument:data( numpy ndarray (structured or homogeneous), dict, or DataFrame)
#index dummy argument:Index of the element. The default is numbers like a subscript array
#columns Formal argument:Two-dimensional index. The default is a number
#dtype dummy argument:data type. dtype, default None
#copy dummy argument:copy. The default is false.
#3
print(DataFrame(numpy.array([[0,0],[1,1]])))
#4
print(DataFrame(numpy.array([[0,0],[1,1]]), index=['a', 'b']))
#5
print(DataFrame(numpy.array([[0,0],[1,1]]), index=['a', 'b'], columns=['x', 'y']))

result

#1
0    0
1    1
dtype: int64

#2
x    2
y    3
Name: value, dtype: int64

#3
   0  1
0  0  0
1  1  1

#4
   0  1
a  0  0
b  1  1

#5
   x  y
a  0  0
b  1  1

Recommended Posts

[Python] What is pandas Series and DataFrame?
[Python] Python and security-① What is Python?
Basic operation of Python Pandas Series and Dataframe (1)
What is python
What is Python
[Python] What is Pipeline ...
[Python] What is virtualenv
Python application: Pandas # 3: Dataframe
What is "functional programming" and "object-oriented" in Python?
What are you comparing with Python is and ==?
Python application: Pandas Part 2: Series
Python 2 series and 3 series (Anaconda edition)
[Python] * args ** What is kwrgs?
[Python learning part 3] Convert pandas DataFrame, Series, and standard List to each other
Identity and equivalence Python is and ==
What is a python map?
Python Basic Course (1 What is Python)
Python 3.4 series is safe for installing and executing Python Kivy (macOS)
Graph time series data in Python using pandas and matplotlib
[Python] Random data extraction / combination from DataFrame using random and pandas
What is Python? What is it used for?
[Python] What is a zip function?
[Python] What is a with statement?
Python hand play (Pandas / DataFrame beginning)
[Python] Operation memo of pandas DataFrame
About installing Pwntools and Python2 series
Difference between == and is in python
[Python] How to use Pandas Series
[Python] What is @? (About the decorator)
[Python] What are @classmethods and decorators?
[python] What is the sorted key?
Python for statement ~ What is iterable ~
Difference between python2 series and python3 series dict.keys ()
What is the python underscore (_) for?
Python> What is an extended slice?
[Python] How to add rows and columns to a table (pandas DataFrame)
[Python] What is inherited by multiple inheritance?
What is NaN? NaN Zoya (Python) (394 days late)
[Pandas] What is set_option [How to use]
[Python] [pandas] How is pd.DataFrame (). T implemented?
What kind of programming language is Python?
Python learning basics ~ What is type conversion? ~
Python application: Pandas Part 4: DataFrame concatenation / combination
What is "mahjong" in the Python library? ??
What is a dog? Python installation volume
[Python] Add total rows to Pandas DataFrame
Easy introduction of python3 series and OpenCV3
Adding Series to columns in python pandas
How to use is and == in Python
Is there NaN in the pandas DataFrame?
[Introduction to Python] What is the difference between a list and a tuple?
Read CSV file with Python and convert it to DataFrame as it is
What is namespace
[What is an algorithm? Introduction to Search Algorithm] ~ Python ~
What is copy.copy ()
What is the difference between `pip` and` conda`?
Python is easy
My pandas (python)
What is Django? .. ..
Python Pandas is not suitable for batch processing
What is dotenv?