Code Monkey home page Code Monkey logo

python-playground's Introduction

Python Playground

A sandbox for exploring, learning and creating with Python!

Player Scrape

This Python script scrapes player data from FantasyPros for a given list of player names. The scraped data includes player rankings, 'Last 15' statistics, and other detailed player data.

The 'Last 15' stats are the player's performance in the last 15 days and can be used for tracking recent performance trends.

The final output is provided as an HTML file named probable-pitchers.html, providing an easy-to-read overview of the data.

Prerequisites

The script requires the following Python packages:

pip install requests beautifulsoup4 pandas

Usage

Specify the list of players you're interested in by providing their full names and short names in the full_names and player_names variables respectively.

full_names = ['Brayan Bello', 'Jose Berrios', ...]
player_names = ['B. Bello', 'J. Berrios', ...]

Run the script. It will scrape the data from the website for each player listed, output the DataFrame in the console, and write it as an HTML file (probable-pitchers.html) in your local directory.


Strip Quotes

JSON to JS Converter

This Python script converts a JSON file into a JavaScript (JS) file. It's useful when you need to use the data stored in a JSON file in a JavaScript context.

The script reads a JSON file, converts its contents to a JavaScript-compatible format, and writes the result into a new JS file.

Call the json_to_js(input_filename, output_filename) function, providing the name of your input JSON file and the desired name for your output JS file.

json_to_js('input.json', 'output.js')

The function json_value_to_js(value) helps in recursively converting each value of JSON file into a JavaScript compatible format. This function handles JSON objects (dict in Python), arrays (list in Python), and other basic data types (strings, numbers, booleans, and null).


Text Manip

Text Manipulation Script

This Python script provides users with the capability to manipulate text from a file. The current functionalities include:

  • Converting text into a sentence case (capitalizing the first word of each sentence).
  • Converting the entire text to lowercase.
  • Converting the entire text to uppercase.

Moreover, the script ensures that:

  • All letters in the text (other than the first word of a sentence and the word 'I') are in lowercase for the sentence case.
  • A period is added at the end if there isn't one already when using the sentence case.

Usage

Save the text you want to manipulate in a file named input.txt.

Run the script using the following syntax:

python3 text_manip.py [sentence|lower|upper]

The processed text will be saved to a file named output.txt in the same directory.

The script's structure allows for easy addition of other text manipulation functionalities. Simply add a new function for the desired operation and include it in the command-line argument parsing.


If you have any questions, suggestions, or issues, feel free to open an issue or a pull request. I am always open to new ideas and improvements. I look forward to seeing how you use this script in your own projects!

Remember, the key to great programming is experimentation. Don't be afraid to use this script as a starting point and then modify it to better suit your needs. Happy coding!

python-playground's People

Contributors

nbrinson2 avatar

Watchers

 avatar

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.