0
Panda Series, 1D array and Dictionary Difference
I am very much confuse between Panda series, one dimensional array and dictionary,,,, when to use them,, plz can someone elaborate...
3 ответов
+ 2
Pandas:
Pandas is a Python module that helps us read and manipulate data. What's cool about pandas is that you can take in data and view it as a table that's human readable.
1D array:
import numpy as np
arr = np.array([0,1,2,3])
Above is 1D with 4 constant integers. 1D array is a array with 1xn constant
https://www.sololearn.com/learn/6671/?ref=app
Dictionary:
Dic = { key : value }
https://www.sololearn.com/learn/Python/2450/?ref=app
https://www.sololearn.com/learn/Python/2451/?ref=app
+ 2
Series is a pandas type. The values stored in in may but need not to be numeric. You might want to use it in data analysis.
1D array is basically a list of values. In case you mean numpy arrays, it is a 1xN matrix. You could use numpy arrays for performing matrix operations.
A dictionary is a python built-in type that holds key-value pairs (keys must be unique within a dictionary).
By the way, you can easily convert a dictionary into a pandas data frame. You can think of a data frame column as a series.
+ 1
Pandas series are completely different!
They are for making a table and analysing it and manipulating it! They are most of the time used in plotting and basic ml
1D array of numpy can store only 1 data type! And many more features (that are already mentioned in the course)
Dictionaries are a set of keys and values! Here we cannot directly access the value without knowing the key or index! Dictionaries are preferred most of the time for storing many characteristics of particular key! ( It is an alternative to OOP, tho not completely)