Python Pandas For Class XI Tutorial 1
Python Pandas For Class XI Tutorial 1
4.2.2. Transfer data between CSV files/SQL databases, and Data Frame objects.
Series 1 D array
23 14 56 28 43 39 19 40 65
Index order is persisted and the missing element is filled with NaN (Not a number).
Create a Series from Scalar
If data is a scalar value, an index must be provided. The value will be repeated to match the length of
index.
Example 1
2. Why it is used?
3. Write a Python program to create and display a series of even numbers 2, 4, 6, 8, 10, 12, 14, 16, 18,
20 using Pandas module. Also do the following:
a. Display the first 5 index values.
b. Display the last 5 index values.
c. Display index 4,6,and 8.
d. Display the first four index values.
e. Display the index 3 to 7.
f. Display the index 6 to end.
g. Display using data.iloc[2:7]
4. Write a Python program to create and display a series of even numbers 2, 4, 6, 8, 10, 12, 14, 16, 18,
20 with index value a, b, c, d, e, f, g, h, I, j using Pandas module.
a. Display the first 5 index values.
b. Display the last 5 index values.
c. Display index 4,6,and 8.
d. Display the first four index values.
e. Display the index 3 to 7.
f. Display the index 6 to end.
g. Using data.loc[‘d’:’h’]
5. Write a Python program to create a series of list [ 34, 29, 65, 57, 42] and do the following:
a. Raise to power 2 of values
b. Add 1000
c.. Subtract 500
d. Multiply by 2
e. Divide by 20
f. Display all the values greater than 50
6. Write a Python program to create and display a series of dictionary consists of Name : Marks of your
ten friends and do the following:
a. Display the first five values.
b. Display the last three values.
c. Give the index with two extra value and then display.
7. Write a Python program to create a series of scalar value 500 of index ‘A’..’F’.