Skip to main content

Data science class -004

  •    Data Science - steps
  •    Data Sizing
  •    Examples
  •    Lists
  •    Dictionaries
  •    Dataframes

 


 

 
 
 
thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(
thislist[2:5]) 
 
This example returns the items from "orange" (-4) to, but NOT including "mango" (-1):
thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(
thislist[-4:-1]) 
 
 
thislist = ["apple", "banana", "cherry"]
if "apple" in
thislist:
  print("Yes, 'apple' is in the fruits list")
  
thislist = ["apple", "banana", "cherry"]
tropical = ["mango", "pineapple", "papaya"]
thislist.extend(tropical)
print(
thislist)
 
thisdict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964,
 
"year": 2020
}
print(
thisdict)
  
 
Pandas is a Python library used for working with data sets.
It has functions for analyzing, cleaning, exploring, and manipulating data.
The name "Pandas" has a reference to both "Panel Data", and "Python Data Analysis" and was created by Wes McKinney in 2008.
import pandas as pd

data = {
  "calories": [420380390],
  "duration": [504045]
}

#load data into a DataFrame object:
df = pd.DataFrame(data)

print(df
 

>>> for x in thisdict:
...     print(thisdict[x])
...
Ford
Mustang
2015
red

{'brand': 'Ford', 'model': 'Mustang', 'year': 2015, 'color': 'red'}
>>> for x in thisdict:
...     print(x)
...
brand
model
year
color


Dara frames

import pandas as pd

data = {
  "calories": [420, 380, 390],
  "duration": [50, 40, 45]
}

#load data into a
DataFrame object:
df = pd.DataFrame(data)

print(
df

 
CSV
 

The number of rows returned is defined in Pandas option settings.

You can check your system's maximum rows with the pd.options.display.max_rows statement.

 
 
import pandas as pd

df = pd.read_csv('data.csv')

print(df.to_string()) 

import pandas as pd
print(pd.options.display.max_rows) 

Duration,Pulse,Maxpulse,Calories
60,110,130,409.1
60,117,145,479.0
60,103,135,340.0
45,109,175,282.4
45,117,148,406.0
60,102,127,300.5
60,110,136,374.0
45,104,134,253.3
30,109,133,195.1
60,98,124,269.0
60,103,147,329.3
60,100,120,250.7
60,106,128,345.3
60,104,132,379.3
60,98,123,275.0
60,98,120,215.2
60,100,120,300.0
45,90,112,
60,103,123,323.0
45,97,125,243.0
60,108,131,364.2
45,100,119,282.0
60,130,101,300.0
45,105,132,246.0
60,102,126,334.5
60,100,120,250.0
60,92,118,241.0
60,103,132
60,100,132,280.0
60,102,129,380.3
60,92,115,243.0
45,90,112,180.1
60,101,124,299.0
60,93,113,223.0
60,107,136,361.0
60,114,140,415.0
60,102,127,300.5
60,100,120,300.1
60,100,120,300.0
45,104,129,266.0
45,90,112,180.1
60,98,126,286.0
60,100,122,329.4
60,111,138,400.0
60,111,131,397.0
60,99,119,273.0
60,109,153,387.6
45,111,136,300.0
45,108,129,298.0
60,111,139,397.6
60,107,136,380.2
80,123,146,643.1
60,106,130,263.0
60,118,151,486.0
30,136,175,238.0
60,121,146,450.7
60,118,121,413.0
45,115,144,305.0
20,153,172,226.4
45,123,152,321.0
210,108,160,1376.0
160,110,137,1034.4
160,109,135,853.0
45,118,141,341.0
20,110,130,131.4
180,90,130,800.4
150,105,135,873.4
150,107,130,816.0
20,106,136,110.4
300,108,143,1500.2
150,97,129,1115.0
60,109,153,387.6
90,100,127,700.0
150,97,127,953.2
45,114,146,304.0
90,98,125,563.2
45,105,134,251.0
45,110,141,300.0
120,100,130,500.4
270,100,131,1729.0
30,159,182,319.2
45,149,169,344.0
30,103,139,151.1
120,100,130,500.0
45,100,120,225.3
30,151,170,300.1
45,102,136,234.0
120,100,157,1000.1
45,129,103,242.0
20,83,107,50.3
180,101,127,600.1
45,107,137,
30,90,107,105.3
15,80,100,50.5
20,150,171,127.4
20,151,168,229.4
30,95,128,128.2
25,152,168,244.2
30,109,131,188.2
90,93,124,604.1
20,95,112,77.7
90,90,110,500.0
90,90,100,500.0
90,90,100,500.4
30,92,108,92.7
30,93,128,124.0
180,90,120,800.3
30,90,120,86.2
90,90,120,500.3
210,137,184,1860.4
60,102,124,325.2
45,107,124,275.0
15,124,139,124.2
45,100,120,225.3
60,108,131,367.6
60,108,151,351.7
60,116,141,443.0
60,97,122,277.4
60,105,125,
60,103,124,332.7
30,112,137,193.9
45,100,120,100.7
60,119,169,336.7
60,107,127,344.9
60,111,151,368.5
60,98,122,271.0
60,97,124,275.3
60,109,127,382.0
90,99,125,466.4
60,114,151,384.0
60,104,134,342.5
60,107,138,357.5
60,103,133,335.0
60,106,132,327.5
60,103,136,339.0
20,136,156,189.0
45,117,143,317.7
45,115,137,318.0
45,113,138,308.0
20,141,162,222.4
60,108,135,390.0
60,97,127,
45,100,120,250.4
45,122,149,335.4
60,136,170,470.2
45,106,126,270.8
60,107,136,400.0
60,112,146,361.9
30,103,127,185.0
60,110,150,409.4
60,106,134,343.0
60,109,129,353.2
60,109,138,374.0
30,150,167,275.8
60,105,128,328.0
60,111,151,368.5
60,97,131,270.4
60,100,120,270.4
60,114,150,382.8
30,80,120,240.9
30,85,120,250.4
45,90,130,260.4
45,95,130,270.0
45,100,140,280.9
60,105,140,290.8
60,110,145,300.4
60,115,145,310.2
75,120,150,320.4
75,125,150,330.4
 


 
 



 

Comments

Popular posts from this blog

AI Agents for Enterprise Leaders -Next Era of Organizational Transformation

  AI Agents for Enterprise Leaders: Charting a Course into the Next Era of Organizational Transformation Introduction AI agents and multiagent AI systems represent more than just technological advancements. They signify a fundamental shift in how organizations can automate processes, improve human-machine collaboration, generate insights, and respond dynamically to complex challenges. These systems offer the potential to unlock significant value across a wide range of functions—from enhancing customer interactions and optimizing supply chains to driving innovation in product development and service delivery. Realizing the Benefits To realize these benefits, organizations must engage in deliberate planning, make strategic investments, and foster a culture of continuous improvement and technological advancement. By aligning AI agent initiatives with core business goals, investing in the right infrastructure, and nurturing a culture of innovation, enterprises can position themselves t...

Airport twin basic requirements

  1. 3D Model of  New Terminal Arrivals Area: Develop a high-fidelity 3D model of the New Terminal Arrivals Area using provided LiDAR/CAD data and images. Include key elements like baggage carousels, immigration counters, customs checkpoints, and waiting areas. 2. Real-time Passenger Flow Monitoring: Integrate with Xovis and CCTV systems to track passenger movement in real-time. Visualize passenger flow on the 3D model, highlighting congestion areas and potential bottlenecks. Display real-time passenger count and density information on dashboards. 3. Baggage Handling Visualization: Integrate with the baggage handling system to track baggage movement in real-time. Visualize baggage flow on the 3D model, showing baggage movement from aircraft to carousels. Display real-time baggage status and potential delays on dashboards. 4. Security Monitoring: Integrate with CCTV feeds to monitor the Arrivals Area for suspicious activities. Implement AI-powered video analytics f...

The AI Revolution: Are You Ready? my speech text in multiple languages -Hindi,Arabic,Malayalam,English

  The AI Revolution: Are You Ready?  https://www.linkedin.com/company/105947510 CertifAI Labs My Speech text on Future of Tomorrow in English, Arabic ,Hindi and Malayalam , All translations done by Gemini LLM "Imagine a world with self-writing software, robots working alongside us, and doctors with instant access to all the world's medical information. This isn't science fiction, friends; this is the world AI is building right now. The future isn't a distant dream, but a wave crashing upon our shores, rapidly transforming the job landscape. The question isn't if this change will happen, but how we will adapt to it." "Think about how we create. For generations, software development was a complex art mastered by a select few. But what if anyone with an idea and a voice could bring that idea to life? What if a child could build a virtual solar system in minutes, simply by asking? We're moving towards a world where computers speak our language, paving the...