Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
34 views

Python For Data Science Assignment .Ipynb - Colaboratory

The document shows code for various Python data science tasks including: 1) Working with lists - defining, printing, indexing, appending, extending, modifying values 2) Working with files - opening, reading, writing, iterating over lines 3) Working with NumPy - creating arrays, calculating statistics like mean, variance, standard deviation 4) Working with SciPy - calculating cube roots and permutations 5) Working with Pandas - reading CSV files, plotting dataframes The code covers common data manipulation and analysis techniques in Python.

Uploaded by

MATHIVANAN M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Python For Data Science Assignment .Ipynb - Colaboratory

The document shows code for various Python data science tasks including: 1) Working with lists - defining, printing, indexing, appending, extending, modifying values 2) Working with files - opening, reading, writing, iterating over lines 3) Working with NumPy - creating arrays, calculating statistics like mean, variance, standard deviation 4) Working with SciPy - calculating cube roots and permutations 5) Working with Pandas - reading CSV files, plotting dataframes The code covers common data manipulation and analysis techniques in Python.

Uploaded by

MATHIVANAN M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

7/13/2021 Copy of Copy of python for data science assignment .

ipynb - Colaboratory

a=int(input())
def nmg():
 a=int(input())
 print("local variable:",a)
nmg()
print("global variable:",a)

#list
a=[54,24,26,59,95,84]
b=len(a)
#list printing
print(a)
#negative indexing
print("elements displayed with negative indexing")
print(a[-7:])
n=int(input("Enter the negative value of number between -1 to 7"))
print(a[n])

#append method
print("append method")
m=int(input("enter the number you need to add in the list:"))
a.append(m)
print(a)
print("Element is added at last...")

#join two list
c=[11,22,33,44,55,66]
d=[1,2,3,4,5,6]
c.extend(d)
print("Joining two list")
print(c)

p=int(input("At which position you need to chane the value:"))
q=int(input("what value you need to add"))
c[p]=q
print("number changed at",p+1)
print(c)

del c
print("After using del keyword list will not be identified")

%%writefile file.txt
Hi this is MATHIVANAN M

pwd

#add the file name at the end of the file path..("file.txt")
myfile=open('C:\\Users\\HP\\file.txt')
https://colab.research.google.com/drive/1bPvtD473v0LIMJmrC3521ZDJQcMjbd3T#printMode=true 1/3
7/13/2021 Copy of Copy of python for data science assignment .ipynb - Colaboratory

myfile.read()

myfile.seek(0)
myfile.readlines()

for line in open('file.txt'):
print(line)

with open('file.txt',mode='r') as f:
print(f.close())

import numpy as np
a=np.array([25,67,78,45,36,90,79,56])
print(a)
print("size of array is",np.size(a))
print("mean",np.mean(a))
print("\nvariance",np.var(a))
print("\nstandard deviation",np.std(a))

from scipy.special import cbrt
a=int(input())
x=cbrt(a)
print("cube rooT of a is",x)
print("After rounding",int(x))

from scipy.special import perm
a=int(input("permutation of the number:"))
b=int(input("how many time the permutation process shoud go:"))
per=perm(a,b,exact=True)
print(per)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
a=pd.read_csv("covid 19.csv")
a.head()

x=a['ConfirmedIndianNational']
y=a['Deaths']
plt.xlabel("Date")
plt.ylabel("Death")
plt.plot(x,y)
plt.show()

a.plot()
plt.legend()
https://colab.research.google.com/drive/1bPvtD473v0LIMJmrC3521ZDJQcMjbd3T#printMode=true 2/3
7/13/2021 Copy of Copy of python for data science assignment .ipynb - Colaboratory

https://colab.research.google.com/drive/1bPvtD473v0LIMJmrC3521ZDJQcMjbd3T#printMode=true 3/3

You might also like