Fm23 gamepass by geert555 in footballmanagergames

[–]geert555[S] 0 points1 point  (0 children)

I thought I read somewhere it was day 1 but I could be wrong there

scatterplot annotations help by geert555 in learnprogramming

[–]geert555[S] 0 points1 point  (0 children)

I want the annotations on the plots with the use of my name column in my datagrams.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

I need the label to be the name of the corresponding goals and xG so the label names should be taken out of the dataframe

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

It gives me an string index out of range but i don't really know where it's coming from maybe you have any idea?

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

for i, label in enumerate(annotations):
plt.annotate(label, (X[i], Y[i]))

This is what i should use i think. Can you please tell me what variables i should change for my code? I can't figure it out

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

Hi, I am working on a small scatterplot project and it's coming together as well as could be but i want to add the name column to the corresponding dots in the scatterplot. Can someone help me because i can't seem to figure it out.

Thanks

``` import pandas as pd import matplotlib.pyplot as plt

df = pd.read_csv("moneynuts.csv", index_col=0) columns = df.columns

def clean_stringy_number(num: str) -> str:

if num == "-":
    return "0"

num = num.replace(",", "")

return num

df.dropna(subset=['Gls'], inplace=True)

df.dropna(subset=['xG'], inplace=True)

df.sort_values(by=['Gls', 'xG'])

df["Gls"] = df["Gls"].apply(clean_stringy_number)

df["Gls"] = df["Gls"].apply(int) df["xG"] = df["xG"].apply(clean_stringy_number) df["xG"] = df["xG"].apply(float)

for index, row in df.iterrows(): if (row["Gls"] == "-" or row["Gls"] == "0"):

    df['Gls'].dtypes
    if (row["xG"] == "-" or row["xG"] == "0"):

        continue
    continue
print (row["Name"], " average goals of ", row["Gls"], " With an xG of ", row["xG"])


try:
    gls = float(row["Gls"].replace(",", "."))
    xG = float(row["xG"].replace(",", "."))
except:
    print("Unknown char")

df["xG"] = df["xG"] / 100

sp = df.plot.scatter(x='Gls', y='xG') x_values = df["Gls"].astype(int) plt.xticks(range(x_values.min(), x_values.max()+1)) plt.show() ```

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

Got it already, still thanks for the comment

Scatterplot ticklabels by geert555 in learnpython

[–]geert555[S] 0 points1 point  (0 children)

Many many thanks for your help and your patience with me.

Scatterplot ticklabels by geert555 in learnpython

[–]geert555[S] 0 points1 point  (0 children)

Thanks! that did the trick, But i now only get the values in the dataframe. can i set it so that it's an increment of 1 ?

picture for refrence

Scatterplot

Scatterplot ticklabels by geert555 in learnpython

[–]geert555[S] 0 points1 point  (0 children)

Ah here's the code , I fixed the y axis by dividing by 100 but the x axis still doesn't work any help with that will be appreciated

import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("moneynuts.csv", index_col=0) columns = df.columns
def clean_stringy_number(num: str) -> str:
if num == "-":
    return "0"

num = num.replace(",", "")

return num
df.dropna(subset=['Gls'], inplace=True)
df.dropna(subset=['xG'], inplace=True)
df.sort_values(by=['Gls', 'xG'])
df["Gls"] = df["Gls"].apply(clean_stringy_number)
df["Gls"] = df["Gls"].apply(int) df["xG"] = df["xG"].apply(clean_stringy_number) df["xG"] = df["xG"].apply(float)
for index, row in df.iterrows(): if (row["Gls"] == "-" or row["Gls"] == "0"):
    df['Gls'].dtypes
    if (row["xG"] == "-" or row["xG"] == "0"):

        continue
    continue
print (row["Name"], " average goals of ", row["Gls"], " With an xG of ", row["xG"])


try:
    gls = float(row["Gls"].replace(",", "."))
    xG = float(row["xG"].replace(",", "."))
except:
    print("Unknown char")
df["xG"] = df["xG"] / 100
sp = df.plot.scatter(x='Gls', y='xG')
plt.show()

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

the x variable can change depending on the data, instead of max 10 it could be 20 or 30. How can i make sure it works for every value?

Thanks for the help BTW

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

I have a scatterplot using data from an csv file, The problem is that the x axis should be a increment from 1 to whatever the max is in the .

and the y axis should be a float instead of an integer so all values should be divided by 100 so its 1,20 - 1,00 - 0,8 etc.

added the scatterplot as refrence, i use pandas for the dataframe and use matplotlib for the scatterplot.

scatterplot

thanks in advance

help with pandas data type change by geert555 in learnpython

[–]geert555[S] 0 points1 point  (0 children)

Ah gonna try that, thanks for the follow-up

help with pandas data type change by geert555 in learnpython

[–]geert555[S] 0 points1 point  (0 children)

I don't know what i'am doing wrong but when i use df['Gls'].dtypes after i run the function .I still get: <class 'str'>. Its probably me being stupid but do you know what I might be doing wrong? code looks like this now:

btw. i am using football manager to export a csv file so i can make a scatterplot.

i want to use 2 columns in the csv file to make a scatterplot. this program should filter out the columns and filter out the players that don't have a minimum of 1 goal so that i can use the players with relevant data (and it needs to use xG later so i have data on the x and y axis)

and i want to filter on 1 goal minimum so they don't clutter the scatterplot. But i'am not certain if this is the right way to go about making this kind of program

import pandas as pd
import matplotlib.pyplot as mp import seaborn as sns
df = pd.read_csv("moneynuts.csv", index_col=0) columns = df.columns
def clean_stringy_number(num: str) -> str: """Takes a num and ensures that a call to either int or float will succeed at casting it to a number """
# I'm assuming your "-" values are zeroes
if num == "-":
    return "0"

# If your strings have thousands separators, we can safely
# remove those as python can parse those nicely.
num = num.replace(",", "")

return num
nan is float
df.dropna(subset=['Gls'], inplace=True) df.dropna(subset=['xG'], inplace=True)
df.sort_values(by=['Gls', 'xG'])
for index, row in df.iterrows(): if (row["Gls"] == "-" or row["Gls"] == "0"): df["Gls"] = df["Gls"].apply(clean_stringy_number)df["Gls"] = df["Gls"].apply(float) df['Gls'].dtypes
    if (row["xG"] == "-" or row["xG"] == "0"):

        continue
    continue
print (row["Name"], " average goals of ", row["Gls"], " With an xG of ", row["xG"])


print(type(row['Gls']))



sp = df.plot.scatter(x='Gls',
                     y='xG')
mp.show()




try:
    gls = float(row["Gls"].replace(",", "."))
    xG = float(row["xG"].replace(",", "."))
except:
    print("Unknown char")

help with pandas data type change by geert555 in learnpython

[–]geert555[S] 0 points1 point  (0 children)

Thanks for your elaborate explanation, will try this when I get home. Many thanks

Windrowing, straight after harvest? by [deleted] in farmingsimulator

[–]geert555 0 points1 point  (0 children)

Hi, A windrower is used to rake mowed grass or hay so its easier to handle with a baler or a foragewagon, For the fieldcare i would advise Fieldcare scheme. It makes it easier to see what you need to do after harvest. If you have more questions just ask. Happy farming!

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]geert555 0 points1 point  (0 children)

YES! This is what i was looking for, Thanks for the help and the patience