Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
suyashi29
GitHub Repository: suyashi29/python-su
Path: blob/master/Python for Data Science/Day1 Python for Data Science.ipynb
3074 views
Kernel: Python 3 (ipykernel)
  • obtaining knowledge from often enormously large data sets.

  • process include analysis, preparing data for analysis, and presenting results to support organisational decisions

Data Science is the combination of

  • statistics,

  • mathematics,

  • programming,

  • problem-solving,

  • capturing data in ingenious ways, the ability to look at things differently,

  • and the activity of cleansing, preparing and aligning the data.

image-3.png

Python For Data Science

  • Python is one of the most popular languages used by Data Scientists. Python has in-built mathematical libraries and functions, making it easier to calculate mathematical functions.

Data Containers in Python

  1. Strings 2. Lists 3. Tuples 4. Dictionary

12, 12.3, -12.5 type(12) type(-12.3)
float

Strings

X="Python" type(X) ## Check Data Type len(X) ## display number of members ## Indexing X[-6], X[1],X[-1] X[1:4] #n:n-1
'yth'
x="data" x.casefold() z=x.encode() x.isalnum() x.isalpha() x.isascii() x.isdecimal() x.isspace() x.join("a")
'a'
x="12Ram" z=x.encode() z type(z)
bytes
x.isdecimal()
False
## Please create a user name of length 6, create a password of lenghth 7 and ##all details are correct you can type"Credentials created welcome to home page user=input("Create user name for minimum 6 lenghth:") if len(user) >= 6: print("Valid user name") else: print("Ops! User name not created invalid format")
Create user name for minimum 6 lenghth:wehi Ops! User name not created invalid format

List

a=[1,2,3] b=[1,2,"a"] a[1] max(a) min (a) a+a
[1, 2, 3, 1, 2, 3]
z="ashi" ## We cannot do changes to strings like deleting members or adding new members y=["a","s","h","i"] #Deletion and addition of new members is possible in list ## del z[0] #y[3] = 2 del y[0]
y y.append("d") y y.insert(2,"i")
y
['s', 'h', 'i', 'i', 'd', 'd', 'd', 'd']
## Tuples a=(1,2,3) b=type(a) b ## tuples also does nit support item aadition or deletion.
tuple
x=y.append("3") x
y
['s', 'h', 'i', 'i', 'd', 'd', 'd', 'd', '3', '3']
print(x)
None

Dictionary

  • Mapping data types

  • Key value pairs

  • key are index to members for dictionary

  • Keys are unique with one value for one key

  • Duplicate Key creation is not possible

d={} d={1:"avi",2:"om",3:"Shri"} d
{1: 'avi', 2: 'om', 3: 'Shri'}
d[1],d[2]
('avi', 'om')
d.keys()
dict_keys([1, 2, 3])
d.values()
dict_values(['avi', 'om', 'Shri'])
d[4] ="Deb"
d
{1: 'avi', 2: 'om', 3: 'Shri', 4: 'Deb'}
d[1]="vemi"
d
{1: 'vemi', 2: 'om', 3: 'Shri', 4: 'Deb'}
d[5]="om"
d
{1: 'vemi', 2: 'om', 3: 'Shri', 4: 'Deb', 5: 'om'}
del d[1]
d
{2: 'om', 3: 'Shri', 4: 'Deb', 5: 'om'}
## Create a dic named Emp_details with Emp ID as Keys and job roels as values. "A101, B101"
'A101'