Skip to content

Instantly share code, notes, and snippets.

@ryanorsinger
Created August 20, 2019 14:47
Show Gist options
  • Save ryanorsinger/097d7a0ee8e2038a1543be65c8675114 to your computer and use it in GitHub Desktop.
Save ryanorsinger/097d7a0ee8e2038a1543be65c8675114 to your computer and use it in GitHub Desktop.
Pandas Warmups
Planet Mass Diameter DayLength SunDistance OrbitPeriod OrbitVelocity MeanTemperature SurfacePressure Moons Rings MagneticField FirstVisited FirstMission
MERCURY 0.33 4879 4222.6 57.9 88 47.4 167 0 0 No Yes 1974-03-29 Mariner 10
VENUS 4.87 12,104 2802 108.2 224.7 35 464 92 0 No No 1962-08-27 Mariner 2
EARTH 5.97 12,756 24 149.6 365.2 29.8 15 1 1 No Yes NA NA
MOON 0.073 3475 708.7 NA 27.3 1 -20 0 0 No No 1959-09-12 Luna 2
MARS 0.642 6792 24.7 227.9 687 24.1 -65 0.01 2 No No 1965-07-15 Mariner 4
JUPITER 1898 142,984 9.9 778.6 4331 13.1 -110 NA 67 Yes Yes 1973-12-04 Pioneer 10
SATURN 568 120,536 10.7 1433.5 10,747 9.7 -140 NA 62 Yes Yes 1979-09-01 Pioneer 11
URANUS 86.8 51,118 17.2 2872.5 30,589 6.8 -195 NA 27 Yes Yes 1986-01-24 Voyager 2
NEPTUNE 102 49,528 16.1 4495.1 59,800 5.4 -200 NA 14 Yes Yes 1989-08-25 Voyager 2
PLUTO 0.0146 2370 153.3 5906.4 90,560 4.7 -225 0.00001 5 No NA 2015-07-14 New Horizons
  1. Import the contents of "planets.csv" into a pandas DataFrame.
  2. Convert any dates contained in strings to a datetime data format.
  3. Write the pandas necessary to show only the planets with a magnetic field
  4. Count how many months passed between when we first visited the Moon and Mars.
  5. Show the planets that have moons
  6. Show the planets that have rings
  7. Show planets with a day that is shorter than or equal to Earth's 24 hours.
  8. What is the mean temperature of all the planets together?
  9. What is the hottest planet? Determine this programmatically.
  10. What is the coldest planet? Determine this programmatically.
  11. What planet has the most moons?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment