semvec/pypi-packages huggingface dataset:
pdappendunits 0.2
A utility library for file operations
License: MIT

# pandas_appendunits

pandas_appendunits is a Python package for performing file operations easily. It provides functions to manipulate files such as getting paths of files with specific names or extensions in a directory, and merging multiple files into a single DataFrame.

## Installation

You can install FileUtils using pip:

pip install pdappendunits

## Functions

### files_in_names

Get the paths of the files with the given names in the directory.

```python
import os

def files_in_names(directory, file_names):
    """
    Get the paths of the files with the given names in the directory.
    """
    file_paths = []
    for file_name in file_names:
        file_path = os.path.join(directory, file_name)
        if os.path.exists(file_path):  # Check if the file exists
            file_paths.append(file_path)
        else:
            print(f"File '{file_name}' not found in directory '{directory}'.")
    return file_paths
```

### files_in_extension

Get the paths of the files with the given extension in the directory.

```python
import os

def files_in_extension(directory, extension):
    """
    Get the paths of the files with the given extension in the directory.
    """
    file_paths = []
    for file in os.listdir(directory):
        if file.endswith(extension):
            file_path = os.path.join(directory, file)
            file_paths.append(file_path)
    return file_paths
```

### merge_files

Merge the files into a single DataFrame.

```python
import pandas as pd

def merge_files(file_paths):
    """
    Merge the files into a single DataFrame.
    """
    file_list = []
    for file_path in file_paths:
        df = pd.read_csv(file_path)
        file_list.append(df)
    if file_list:
        return pd.concat(file_list, ignore_index=True)
    else:
        return None
```

## Usage

Here's an example of how to use the functions:

```python

import fileutils as fu

directory = "/path/to/your/directory"
file_names = ["file1.csv", "file2.csv"]  # List of file names
extension = ".csv"  # File extension

```

# Get paths of files with specific names

```python

file_paths = fu.files_in_names(directory, file_names)

```

# Get paths of files with specific extension

```python

file_paths_with_extension = fu.files_in_extension(directory, extension)

```

# Merge files into a single DataFrame

```python

data = fu.merge_files(file_paths_with_extension)

print(data)

```
mockalot 0.3.1
Mockup data generator library.
License: MIT
Requires Python: <4.0,>=3.10

# mockalot

[![codecov](https://codecov.io/gh/flavsdotpy/mockalot/master/graph/badge.svg?token=FMD26G97A7)](https://codecov.io/gh/flavsdotpy/mockalot)
![example workflow](https://github.com/flavsdotpy/mockalot/actions/workflows/ci.yml/badge.svg)

> :warning: **Work In Progress**: Library still in very early stages!

Sample data generator library.  \
The motivation to create this project was the high number of limitations for similar web apps in the free tier. This is easy to run locally, at Jupyter or even have it as a library for other projects.

# Features

This is a library to help with sample data generation in a number of different ways:
> - Modular generators to help you get single random values
> - Full-scope class to generate batches of data
> - Modular writers to have your sample data writen directly into the most popular formats.

# Usage

```python
from mockalot import Mockalot
from mockalot.generators import EmailGenerator, UUIDGenerator, NameGenerator
from mockalot.writers import CSVWriter

mocker = Mockalot()

mocker.set_config("sample_size", 20000) \
      .set_column("id", UUIDGenerator, {}) \
      .set_column("name", NameGenerator, {}) \
      .set_column("email", EmailGenerator, {}) \
      .set_writer(CSVWriter, {"output_filename": "users"})

mocker.run()
```

The snipped above will create a CSV file of 20k lines, consisted of 3 columns(id, name and email), written into `./output/users.csv`.

There are more usage examples [here](./examples/).

# Roadmap

You can see the project's roadmap [here](https://github.com/flavsdotpy/mockalot/issues).

# Author

* **[flavsdotpy](https://github.com/flavsdotpy)**

# License

mockalot is available under the MIT license. See the LICENSE file for more info.