1. Define the Pandas/Python pandas?
Pandas is an open-source library for high-performance data manipulation in Python.
2. What are the different types of Data Structures in Pandas?
There are two different types of Data Structures in Pandas-
1) series
2) DataFrame
3. Explain Series and DataFrame in Pandas.
A series is a one-dimensional array capable of holding numerous data types. A series cannot have more than one column. It has a single parameter.
A DataFrame is a two-dimensional array labelled with rows and columns. It is a common method of storing data in row and column indexes.
4. How to check an empty DataFrame?
df = pd.DataFrame()
print(df)
df.empty
5. Create a DataFrame using List.
list1 = [1,2,3,4,5]
df1 = pd.DataFrame(list1)
df1
6. What Are the Most Important Features Of the Pandas Library?
1) Quick and efficient data manipulation and analysis.
2) Data from various file objects can be loaded.
3) Simple management of missing data
4) create time series functionality enabled
5) Merging and combining data sets
7. How to convert a NumPy array to a DataFrame of a given shape?
s1 = pd.Series(np.random.randint(1,5,12))
print(s1)
df1 = pd.DataFrame(s1.values.reshape(3,4))
df1
8. Create a DataFrame using Dictionary with a list and arrays
dict1 = { "A" : [1,2,3,4,5],
"B" : np.array([10,20,30,40,50])}
df = pd.DataFrame(dict1)
df
9. Write a Pandas program to add, subtract, multiple, and divide two Pandas Series.
s1 = pd.Series([1, 2, 3, 4, 5])
s2 = pd.Series([9, 8, 3, 5, 6])
print(s1)
print(s2)
print(s1+s2)
print(s1-s2)
print(s1*s2)
print(s1/s2)
10. Explain is the use of info, describe, head and tail functions.
info
The data includes the number of columns, column names, column data types, memory use, range index, and the count of cells for each column.
describe
The describe() function returns descriptive statistics for a DataFrame.
head
used to get the first n rows.
tail
used to get the last n rows.