Skip to content

Instantly share code, notes, and snippets.

@Damian89
Created October 25, 2017 15:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Damian89/f8dec904b5cf99acf58a96494c108e5c to your computer and use it in GitHub Desktop.
import pandas
# Einlesen der Datei
training_data = pandas.read_csv("data/numerai_training_data.csv")
# Die ersten 5 Zeilen samt Header ausgeben
print(training_data.head())
# Aus wie vielen Zeilen und Spalten besteht die Datei?
print(training_data.shape)
# Wir wollen nur die ID, Datentyp und den Wert für Feature 1&2
important_data = training_data[["id","data_type", "feature1", "feature2"]]
# Schauen wir uns den Aufbau jetzt an, wir erwarten nat. 4 Spalten
print(important_data.shape)
# Welche Datentypen gibt es?
print(important_data.data_type.unique())
# Wie ist der Durchschnittswert von feature1?
print(important_data.feature1.mean())
# Speichern wir die Summe aus feature 1&2 als neue Spalte:
new_frame = important_data.copy()
new_frame.loc[:,"sum"] = important_data.feature1+important_data.feature2
# und wir prüfen das mal schnell:
print(new_frame.head())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment