I'd like to compare the first column to see if it's the same letter over and over again and count the number of things that are the same. (scoring)I'm doing it at Korap.

Asked 2 years ago, Updated 2 years ago, 16 views

I'd like to grade in Korab.

So first of all right now

from google.colab import files

uploaded = files.upload()

for fn in uploaded.keys():
  print('User uploaded file "{name}" with length {length} bytes'.format(
      name=fn, length=len(uploaded[fn])))

Load files with this.

import pandas as pd 

wordtest = pd.read_csv('/content/test (response) - 11.csv')

wordtest

I'd like to compare here

df = pd.DataFrame(wordtest)

columns = df.columns[1:]

new_df = df.copy(deep=True)

for i in columns:

    new_df.iloc[:, i] = df.iloc[:, 0]

new_df

I think this is completely wrong. Could you set the direction?

In the end, I want to count up to the number of correct answers.

python

2022-09-20 15:12

2 Answers

>>> df = pd.DataFrame({"Answer"):["Next", "From", "Come", "Label", "Button"],
           "YOUNGHEE":["Next", "From", "Come", "Label", "Button",
           "Chul-soo":["Don't know", "Don't know", "Don't know", "Don't know",
           "Kiyoung":["Next", "From", "Come", "Don't Know", "Button"]})
>>> df["Answer"] == df["Kiyoung"]
0     True
1     True
2     True
3    False
4     True
dtype: bool
>>> len (df["Answer"] == df["Kiyoung"])
5
>>> (df["Answer"] == df["Kiyoung"]).sum()
4
>>> 


2022-09-20 15:12

Try scalar, spark

val datas = Map(
    "Answer" -> List ("Next", "From", "Come", "Label", "Button")),
    "YOUNG HEE" -> List ("Next", "From", "Come", "Label", "Button")),
    "Withdrawal" -> List ("I don't know", "I don't know", "I don't know", "I don't know",
    "Kiyoung" -> List ("Next", "From", "Come", "Don't Know", "Buttons")
)

val (keys, values) = (datas.keys.toList, datas.values.toList)
val df = (values(0), values(1), values(2), values(3))._1.zip(t._2)
    .zip(t._3)
    .zip(t._4)
    .map {
        case (((a, b), c), d) => (a, b, c, d)
    }.toDF(keys:_*)

df.agg(
    count($"correct" === $"YOUNGHEE", true).as ("YOUNG HEE SCORE"),
    count($"correct" === $"withdrawal", true).as ("Withdrawal Score"),
    count($"correct" === $"write", true).as ("Starting Score")
).show

+--------+--------+--------+
| Younghee Score | Chulsoo Score | Kiyoung Score |
+--------+--------+--------+
|       5|       0|       4|
+--------+--------+--------+


2022-09-20 15:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.