Skip to content

Modernize IO using only the API #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed

Conversation

bashtage
Copy link
Contributor

@bashtage bashtage commented Jul 22, 2022

This is an attempt to modernize IO using only the API functions. Just a start

  • read_pickle(filepath_or_buffer[, ...])
  • DataFrame.to_pickle(path[, compression, ...])
  • read_table(filepath_or_buffer[, sep, ...])
  • read_csv(filepath_or_buffer[, sep, ...])
  • DataFrame.to_csv([path_or_buf, sep, na_rep, ...])
  • read_fwf(filepath_or_buffer[, colspecs, ...])
  • read_clipboard([sep])
  • DataFrame.to_clipboard([excel, sep])
  • read_excel(io[, sheet_name, header, names, ...])
  • DataFrame.to_excel(excel_writer[, ...])
  • ExcelFile.parse([sheet_name, header, names, ...])
  • Styler.to_excel(excel_writer[, sheet_name, ...])
  • ExcelWriter(path[, engine, date_format, ...])
  • read_json([path_or_buf, orient, typ, dtype, ...])
  • json_normalize(data[, record_path, meta, ...])
  • DataFrame.to_json([path_or_buf, orient, ...])
  • build_table_schema(data[, index, ...])
  • read_html(io[, match, flavor, header, ...])
  • DataFrame.to_html([buf, columns, col_space, ...])
  • Styler.to_html([buf, table_uuid, ...])
  • read_xml(path_or_buffer[, xpath, ...])
  • DataFrame.to_xml([path_or_buffer, index, ...])
  • DataFrame.to_latex([buf, columns, ...])
  • Styler.to_latex([buf, column_format, ...])
  • HDFStore: PyTables (HDF5)
  • read_hdf(path_or_buf[, key, mode, errors, ...])
  • HDFStore.put(key, value[, format, index, ...])
  • HDFStore.append(key, value[, format, axes, ...])
  • HDFStore.get(key)
  • HDFStore.select(key[, where, start, stop, ...])
  • HDFStore.info()
  • HDFStore.keys([include])
  • HDFStore.groups()
  • HDFStore.walk([where])
  • read_feather(path[, columns, use_threads, ...])
  • DataFrame.to_feather(path, **kwargs)
  • read_parquet(path[, engine, columns, ...])
  • DataFrame.to_parquet([path, engine, ...])
  • read_orc(path[, columns])
  • read_sas(filepath_or_buffer[, format, ...])
  • read_spss(path[, usecols, convert_categoricals])
  • read_sql_table(table_name, con[, schema, ...])
  • read_sql_query(sql, con[, index_col, ...])
  • read_sql(sql, con[, index_col, ...])
  • DataFrame.to_sql(name, con[, schema, ...])
  • read_gbq(query[, project_id, index_col, ...])
  • read_stata(filepath_or_buffer[, ...])
  • DataFrame.to_stata(path[, convert_dates, ...])
  • StataReader.data_label
  • StataReader.value_labels()
  • StataReader.variable_labels()
  • StataWriter.write_file()

chunksize = ... # Incomplete
nrows = ... # Incomplete
squeeze = ... # Incomplete
handles = ... # Incomplete
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mind removing those. Might be good to be in sync with @phofl's PR pandas-dev/pandas#46308

obj,
filepath_or_buffer: FilePathOrBuffer,
compression: str | None = ...,
obj: Any,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think object might be better here than Any. I think the rule of thumb is use object if it can literally be any object and use Any when it is too complex to type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems object can cause problems with type checking

https://stackoverflow.com/a/39817126/2551705

although this is probably more to do with loading than saving.

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm that read_csv() and read_table() are the same as what was previously in parsers.pyi ?

bashtage and others added 4 commits July 25, 2022 00:20
Make pickle consistent with upstream pandas
Only include what is in the API
Fully add read table and supporting classes
@twoertwein
Copy link
Member

@bashtage might be easier to break it into multiple PRs: easier to review and probably also easier for you (less rebasing since the individual PRs will be closed more quickly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants