Skip to main content

Just a function to convert everything in Pandas DataFrames / Series to string

Project description

Installation

pip install a-pandas-ex-df-to-string

Usage

from a_pandas_ex_df_to_string import pd_add_to_string
pd_add_to_string()
import pandas as pd
from random import choice
csvtests = [
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_long.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_no2.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_no2_long.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_parameters.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_pm25_long.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_stations.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/baseball.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/titanic.csv",
]
csvfile = choice(csvtests)
df = pd.read_csv(csvfile)
print(df)
print(df.dtypes)
df2=df.ds_to_string()
print(df2)
print(df2.dtypes)

     id                                        description   name
0    bc                                       Black Carbon     BC
1    co                                    Carbon Monoxide     CO
2   no2                                   Nitrogen Dioxide    NO2
3    o3                                              Ozone     O3
4  pm10  Particulate matter less than 10 micrometers in...   PM10
5  pm25  Particulate matter less than 2.5 micrometers i...  PM2.5
6   so2                                     Sulfur Dioxide    SO2
id             object
description    object
name           object
dtype: object
     id                                        description   name
0    bc                                       Black Carbon     BC
1    co                                    Carbon Monoxide     CO
2   no2                                   Nitrogen Dioxide    NO2
3    o3                                              Ozone     O3
4  pm10  Particulate matter less than 10 micrometers in...   PM10
5  pm25  Particulate matter less than 2.5 micrometers i...  PM2.5
6   so2                                     Sulfur Dioxide    SO2
id             string
description    string
name           string
dtype: object

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a_pandas_ex_df_to_string-0.14.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

a_pandas_ex_df_to_string-0.14-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file a_pandas_ex_df_to_string-0.14.tar.gz.

File metadata

File hashes

Hashes for a_pandas_ex_df_to_string-0.14.tar.gz
Algorithm Hash digest
SHA256 479ca528de47c650aeeb33903c94e0755c88cf1cb95e8b5531972b690caad677
MD5 bef1dfbcdecc0214446eed70f6b7732d
BLAKE2b-256 8857e14e7424ef0c597646f999006a3843361cac1aa859b8f1f86b71ef2f8c53

See more details on using hashes here.

File details

Details for the file a_pandas_ex_df_to_string-0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for a_pandas_ex_df_to_string-0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 7d3da187293e30a345967458420d259810b7fa17b06f294e586a6b5b108ed2f7
MD5 5ced908c3989ac1b3314011c1a56c23d
BLAKE2b-256 5fc9d6b86f15cfa4cb9c910f62968c3fc9958517ede786b0a99377d2741d3585

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page