0x53olution
0x53olution

Reputation: 391

How to make a custom diagram with python for data analysis

I am looking for an idea how to change a diagram to make it fit to that picture:

enter image description here

Maybe it would make sense to make the output in a table to klick a row and show it in the diagram. But I have no idea which bib I can use.

The data I have already converted:

import pandas as pd

# Excel-Datei lesen
df = pd.read_csv('Data/DrivingRange.csv', sep=',')
df = df.drop(index=0)

# Carry-Distanz
df['Carry-Distanz'] = pd.to_numeric(df['Carry-Distanz'], errors='coerce')
# Club speed in km/h
df['Schl.gsch.'] = pd.to_numeric(df['Schl.gsch.'], errors='coerce')
# Club Path
df['Schwungbahn'] = pd.to_numeric(df['Schwungbahn'], errors='coerce')
# Face Angle
df['Schlagfläche'] = pd.to_numeric(df['Schlagfläche'], errors='coerce')
# Face to Path
df['Schlagflächenstellung'] = pd.to_numeric(df['Schlagflächenstellung'], errors='coerce')

# Club speed in mph
df['Schl_gsch_mph'] = df['Schl.gsch.'] * 0.621371

# Sequence of clubs
sequence = ['Lob-Wedge', 'Sandwedge', 'Eisen 9', 'Eisen 8', 'Eisen 7', 'Eisen 6', 'Eisen 5', 'Hybrid 4', 'Driver']
df['Schlägerart'] = pd.Categorical(df['Schlägerart'], categories=sequence, ordered=True)

# Sort DataFrame by category
df_sorted = df.sort_values(by='Schlägerart')



df_sorted_filtered = df_sorted[['Schlägerart','Schl_gsch_mph', 'Carry-Distanz', 'Schwungbahn', 'Schlagfläche', 'Schlagflächenstellung']]
df_sorted_filtered.rename(columns={'Schlägerart': 'Club', 'Schl_gsch_mph': 'Club Speed', 'Carry-Distanz' : 'Carry Distance', 'Schwungbahn': 'Club Path', 'Schlagfläche' : 'Face Angle', 'Schlagflächenstellung' : 'Face to Path'}, inplace=True)
print(df_sorted_filtered)

Output:

         Club  Club Speed  Carry Distance  Club Path  Face Angle  Face to Path
30  Lob-Wedge   67.779147       68.842956      -3.89        4.12          8.01
31  Lob-Wedge   67.712039       58.803586       5.71       20.79         15.08
1   Sandwedge   62.611826       76.651350      -1.75       -0.25          1.50
2   Sandwedge   62.007853       60.411199       2.02       -2.80         -4.82
3   Sandwedge   67.197544       93.361768       6.17       -5.94        -12.11

Upvotes: 0

Views: 43

Answers (0)

Related Questions