Coder Social home page Coder Social logo

Critical Hit Ratio & Priority? about pokeapi HOT 2 CLOSED

pokeapi avatar pokeapi commented on July 17, 2024
Critical Hit Ratio & Priority?

from pokeapi.

Comments (2)

 avatar commented on July 17, 2024

Alright, so I wrote a python script for the first one that doesn't use the API, the reason being that the objects returned by the GET responses don't seem to allow collections of moves/pokemon. Ultimately chaining these requests together would be optimal to find outputs that are unique to specially-trained teams. I still use the _CSV_ files, however, as they and pandas were key to this script.

Example 1 Script

import pandas as pd

# retrieve move ids from crit rates
a = open('move_meta.csv')
av = pd.read_csv(a)
av = av[['move_id','crit_rate']]
av = av[(av['crit_rate'] > 0)]
av = av['move_id'].tolist()

# retrieve move id from move identifier
b = open('moves.csv')
bv = pd.read_csv(b)
fz = bv
bv = bv[['id','identifier']]
bv = bv[(bv['identifier'] == 'skill-swap')]
bv = bv['id'].tolist()

# retrieve pokemon id from move id
c = open('pokemon_moves.csv')
cv = pd.read_csv(c)
cv = cv[['pokemon_id','move_id']]
cv = cv[(cv['move_id'] == bv)]
cv = cv.drop_duplicates(cols='pokemon_id')
cv = cv['pokemon_id'].tolist()

# retrieve pokemon ids from move ids
d = open('pokemon_moves.csv')
dv = pd.read_csv(d)
dv = dv[['pokemon_id','move_id']]
dv = dv[(dv['move_id'].isin(av))]
# retrieve pokemon that know skill swap as well
dv = dv[(dv['pokemon_id'].isin(cv))]
dv = dv.drop_duplicates(cols=['pokemon_id', 'move_id'])

# retrieve pokemon identifiers and move identifiers

# first pokemon identifiers
e = open('pokemon.csv')
ey = pd.read_csv(e)
ey = ey[['id','identifier']]
ey = ey.set_index('id')['identifier'].to_dict()
ey = dv.replace({'pokemon_id': ey})

# second move identifiers
fz = fz[['id','identifier']]
fz = fz.set_index('id')['identifier'].to_dict()
fz = ey.replace({'move_id': fz})

final = fz
final.columns = ['Pokemon','Move']
final = final.set_index('Pokemon')
final.to_html('finalfile.html')

print final
# print fz
# print ey
# print dv
# print dv
# print cv
# print bv
# print av

from pokeapi.

zaneadix avatar zaneadix commented on July 17, 2024

Sorry No one has ever gotten back to you on this issue. Honestly I've looked over what you've posted and I'm not 100% sure exactly what your issue is. Is this still something concerning you? I'd like to help if I can

from pokeapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.